From 077352f7a9847a58e198adbf0b3b85742519e131 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Tue, 20 Aug 2013 05:19:16 +0000 Subject: [PATCH] Actually commit the astyle change I spoke of earlier. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4546 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/alan.cc | 2 +- gpsbabel/an1.cc | 4 +- gpsbabel/arcdist.cc | 23 ++- gpsbabel/bend.cc | 4 +- gpsbabel/cet_util.cc | 17 +- gpsbabel/cst.cc | 10 +- gpsbabel/csv_util.cc | 36 ++-- gpsbabel/defs.h | 128 ++++++------ gpsbabel/delbin.cc | 4 +- gpsbabel/destinator.cc | 2 +- gpsbabel/dg-100.cc | 6 +- gpsbabel/easygps.cc | 2 +- gpsbabel/garmin.cc | 6 +- gpsbabel/garmin_fs.cc | 4 +- gpsbabel/garmin_txt.cc | 14 +- gpsbabel/gbfile.cc | 2 +- gpsbabel/gbser_win.cc | 6 +- gpsbabel/gdb.cc | 10 +- gpsbabel/geo.cc | 18 +- gpsbabel/google.cc | 14 +- gpsbabel/googledir.cc | 2 +- gpsbabel/gopal.cc | 2 +- gpsbabel/grtcirc.cc | 5 +- gpsbabel/grtcirc.h | 2 +- gpsbabel/gtm.cc | 11 +- gpsbabel/gtrnctr.cc | 10 +- gpsbabel/height.h | 2 +- gpsbabel/jtr.cc | 2 +- gpsbabel/kml.cc | 112 ++++++----- gpsbabel/lowranceusr4.cc | 63 +++--- gpsbabel/maggeo.cc | 2 +- gpsbabel/magproto.cc | 2 +- gpsbabel/main.cc | 1 - gpsbabel/mmo.cc | 12 +- gpsbabel/mtk_logger.cc | 4 +- gpsbabel/navicache.cc | 7 +- gpsbabel/navilink.cc | 5 +- gpsbabel/osm.cc | 12 +- gpsbabel/ozi.cc | 116 +++++------ gpsbabel/parse.cc | 14 +- gpsbabel/pcx.cc | 40 ++-- gpsbabel/pocketfms_bc.cc | 18 +- gpsbabel/pocketfms_fp.cc | 34 ++-- gpsbabel/pocketfms_wp.cc | 22 +-- gpsbabel/polygon.cc | 32 +-- gpsbabel/position.cc | 36 ++-- gpsbabel/psitrex.cc | 90 ++++----- gpsbabel/queue.cc | 14 +- gpsbabel/radius.cc | 52 ++--- gpsbabel/random.cc | 22 +-- gpsbabel/raymarine.cc | 82 ++++---- gpsbabel/reverse_route.cc | 16 +- gpsbabel/rgbcolors.cc | 12 +- gpsbabel/route.cc | 168 ++++++++-------- gpsbabel/saroute.cc | 62 +++--- gpsbabel/sbn.cc | 36 ++-- gpsbabel/sbp.cc | 12 +- gpsbabel/session.cc | 20 +- gpsbabel/shape.cc | 54 ++--- gpsbabel/shortname.cc | 406 +++++++++++++++++++------------------- gpsbabel/skyforce.cc | 40 ++-- gpsbabel/skytraq.cc | 191 +++++++++--------- gpsbabel/smplrout.cc | 74 +++---- gpsbabel/sort.cc | 10 +- gpsbabel/stackfilter.cc | 38 ++-- gpsbabel/stmsdf.cc | 92 ++++----- gpsbabel/stmwpp.cc | 26 +-- gpsbabel/strptime.h | 2 +- gpsbabel/subrip.cc | 26 +-- gpsbabel/swapdata.cc | 4 +- gpsbabel/tef_xml.cc | 46 ++--- gpsbabel/text.cc | 52 ++--- gpsbabel/tiger.cc | 50 ++--- gpsbabel/tmpro.cc | 22 +-- gpsbabel/tomtom.cc | 72 +++---- gpsbabel/tpg.cc | 20 +- gpsbabel/tpo.cc | 10 +- gpsbabel/trackfilter.cc | 226 ++++++++++----------- gpsbabel/transform.cc | 22 +-- gpsbabel/unicsv.cc | 100 +++++----- gpsbabel/units.cc | 6 +- gpsbabel/util.cc | 376 +++++++++++++++++------------------ gpsbabel/util_crc.cc | 10 +- gpsbabel/uuid.cc | 2 +- gpsbabel/v900.cc | 12 +- gpsbabel/vcf.cc | 20 +- gpsbabel/vecs.cc | 110 +++++------ gpsbabel/vidaone.cc | 14 +- gpsbabel/vitosmt.cc | 26 +-- gpsbabel/vitovtt.cc | 8 +- gpsbabel/vmem.cc | 10 +- gpsbabel/vpl.cc | 14 +- gpsbabel/waypt.cc | 107 +++++----- gpsbabel/wbt-200.cc | 120 +++++------ gpsbabel/wfff_xml.cc | 40 ++-- gpsbabel/wintec_tes.cc | 8 +- gpsbabel/xcsv.cc | 358 ++++++++++++++++----------------- gpsbabel/xhtmlent.cc | 2 +- gpsbabel/xmlgeneric.cc | 10 +- gpsbabel/xmltag.cc | 44 ++--- gpsbabel/xol.cc | 38 ++-- gpsbabel/yahoo.cc | 18 +- 102 files changed, 2218 insertions(+), 2184 deletions(-) diff --git a/gpsbabel/alan.cc b/gpsbabel/alan.cc index 4165863c3..fbceceeee 100644 --- a/gpsbabel/alan.cc +++ b/gpsbabel/alan.cc @@ -422,7 +422,7 @@ static void trl_swap(struct trldata* trldata) /**************************************************************************/ static void str2lab(char* dest, const char* src, int len, const char* fmt, - int n) + int n) { int i,j; diff --git a/gpsbabel/an1.cc b/gpsbabel/an1.cc index b501a1211..11a6e9f78 100644 --- a/gpsbabel/an1.cc +++ b/gpsbabel/an1.cc @@ -812,9 +812,9 @@ Write_One_AN1_Waypoint(const waypoint* wpt) } if (!rec->image_name && !wpt->icon_descr.isNull()) { // FIXME: WTH? -char* t = xstrdup(wpt->icon_descr.toUtf8().data()); + char* t = xstrdup(wpt->icon_descr.toUtf8().data()); FindIconByName(t, &rec->guid); -xfree(t); + xfree(t); } Write_AN1_Waypoint(outfile, rec); diff --git a/gpsbabel/arcdist.cc b/gpsbabel/arcdist.cc index 12a93393b..703a09127 100644 --- a/gpsbabel/arcdist.cc +++ b/gpsbabel/arcdist.cc @@ -80,7 +80,7 @@ arglist_t arcdist_args[] = { #define BADVAL 999999 static void -arcdist_arc_disp_wpt_cb(const waypoint *arcpt2) +arcdist_arc_disp_wpt_cb(const waypoint* arcpt2) { queue* elem, * tmp; waypoint* waypointp; @@ -144,7 +144,7 @@ arcdist_arc_disp_wpt_cb(const waypoint *arcpt2) } static void -arcdist_arc_disp_hdr_cb(const route_head *rte) +arcdist_arc_disp_hdr_cb(const route_head* rte) { /* Set arcpt1 to NULL */ arcdist_arc_disp_wpt_cb(NULL); @@ -170,7 +170,7 @@ arcdist_process(void) arcpt2->latitude = arcpt2->longitude = BADVAL; while ((line = gbfgetstr(file_in))) { - char * pound = NULL; + char* pound = NULL; int argsfound = 0; fileline++; @@ -178,7 +178,7 @@ arcdist_process(void) pound = strchr(line, '#'); if (pound) { if (0 == strncmp(pound, "#break", 6)) { - arcdist_arc_disp_hdr_cb(NULL); + arcdist_arc_disp_hdr_cb(NULL); } *pound = '\0'; } @@ -188,8 +188,7 @@ arcdist_process(void) if (argsfound != 2 && strspn(line, " \t\n") < strlen(line)) { warning(MYNAME ": Warning: Arc file contains unusable vertex on line %d.\n", fileline); - } - else { + } else { waypoint* arcpttmp = arcpt1; arcdist_arc_disp_wpt_cb(arcpt2); arcpt1 = arcpt2; @@ -226,19 +225,19 @@ arcdist_process(void) wp->latitude = ed->prjlatitude; wp->route_priority = 1; if (!arcfileopt && - (ed->arcpt2->altitude != unknown_alt) && - (ptsopt || (ed->arcpt1->altitude != unknown_alt))) { + (ed->arcpt2->altitude != unknown_alt) && + (ptsopt || (ed->arcpt1->altitude != unknown_alt))) { /* Interpolate alititude */ if (ptsopt) { wp->altitude = ed->arcpt2->altitude; } else { wp->altitude = ed->arcpt1->altitude + - ed->frac * (ed->arcpt2->altitude - ed->arcpt1->altitude); + ed->frac * (ed->arcpt2->altitude - ed->arcpt1->altitude); } } if (trkopt && - (ed->arcpt2->GetCreationTime().isValid()) && - (ptsopt || (ed->arcpt1->GetCreationTime().isValid()))) { + (ed->arcpt2->GetCreationTime().isValid()) && + (ptsopt || (ed->arcpt1->GetCreationTime().isValid()))) { /* Interpolate time */ if (ptsopt) { wp->SetCreationTime(ed->arcpt2->GetCreationTime());; @@ -247,7 +246,7 @@ arcdist_process(void) // of the two points. Add that to the first for the // interpolated time. int scaled_time = ed->frac * - ed->arcpt1->GetCreationTime().msecsTo(ed->arcpt2->GetCreationTime()); + ed->arcpt1->GetCreationTime().msecsTo(ed->arcpt2->GetCreationTime()); QDateTime new_time(ed->arcpt1->GetCreationTime().addMSecs(scaled_time)); wp->SetCreationTime(new_time); } diff --git a/gpsbabel/bend.cc b/gpsbabel/bend.cc index 78610fc56..f77ac4a3c 100644 --- a/gpsbabel/bend.cc +++ b/gpsbabel/bend.cc @@ -138,7 +138,7 @@ process_route(const route_head* route_orig, route_head* route_dest) double lat_orig_next = RAD(wpt_orig_next->latitude); double long_orig_next = RAD(wpt_orig_next->longitude); - waypoint* wpt_dest_next = NULL; + waypoint* wpt_dest_next = NULL; if (is_small_angle(lat_orig, long_orig, lat_orig_prev, long_orig_prev, lat_orig_next, long_orig_next)) { @@ -152,7 +152,7 @@ process_route(const route_head* route_orig, route_head* route_dest) } wpt_dest_next = create_wpt_dest(wpt_orig, - lat_orig, long_orig, lat_orig_next, long_orig_next); + lat_orig, long_orig, lat_orig_next, long_orig_next); if (wpt_dest_next != NULL) { route_add_wpt(route_dest, wpt_dest_next); diff --git a/gpsbabel/cet_util.cc b/gpsbabel/cet_util.cc index ee314af76..851254b34 100644 --- a/gpsbabel/cet_util.cc +++ b/gpsbabel/cet_util.cc @@ -1020,8 +1020,9 @@ cet_convert_string(char* str) return res; } -const char * -cet_convert_string(const QString& str) { +const char* +cet_convert_string(const QString& str) +{ // FIXME: this is really weird. Since cet_convert_string wants to free // its argument (!) we make a duplicate just to satisfy that kind of goofy // requirement. @@ -1048,8 +1049,8 @@ cet_convert_waypt(const waypoint* wpt) w->notes = cet_convert_string(wpt->notes); if (gc_data) { - const char *placer = cet_convert_string(gc_data->placer); - const char *hint = cet_convert_string(gc_data->hint); + const char* placer = cet_convert_string(gc_data->placer); + const char* hint = cet_convert_string(gc_data->hint); gc_data->placer = placer; gc_data->hint = hint; xfree(placer); @@ -1080,7 +1081,7 @@ cet_convert_route_hdr(const route_head* route) rte->rte_name = cet_convert_string(route->rte_name); rte->rte_desc = cet_convert_string(route->rte_desc); - const char*rte_url = cet_convert_string(route->rte_url); + const char* rte_url = cet_convert_string(route->rte_url); rte->rte_url = rte_url; xfree(rte_url); } @@ -1266,7 +1267,7 @@ const char* xml_convert_to_char_string_n(const XML_Char* src, int* n) *n = i; /* Appropriately size (not zero terminated) buffer */ - utf8 = utf8b = (char *)xmalloc(i); + utf8 = utf8b = (char*)xmalloc(i); for (j = 0; utf8 < utf8b + i; j++) { utf8 += cet_ucs4_to_utf8(utf8, 6, src[j]); @@ -1298,7 +1299,7 @@ const char* xml_convert_to_char_string(const XML_Char* src) } /* We return a NUL terminated string. */ - utf8 = utf8b = (char *)xmalloc(i + 1); + utf8 = utf8b = (char*)xmalloc(i + 1); in = src; for (j = 0; utf8 < utf8b + i; j++) { @@ -1339,7 +1340,7 @@ const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr) } // Allocate space - char_attrs = (const char **)xmalloc((size + 1) * sizeof(char*)); + char_attrs = (const char**)xmalloc((size + 1) * sizeof(char*)); // Duplicate strings for (i = 0; i < size; ++i) { diff --git a/gpsbabel/cst.cc b/gpsbabel/cst.cc index 1353c31d7..dec667de3 100644 --- a/gpsbabel/cst.cc +++ b/gpsbabel/cst.cc @@ -60,10 +60,10 @@ cst_add_wpt(const route_head* track, waypoint* wpt) if (wpt->shortname != NULL) { waypt_add(waypt_dupe(wpt)); - // Rather than creating a new waypt on each read, tis format bizarrely - // recycles the same one, relying on waypt_dupe() above and then manually - // resetting fields. Weird. - wpt->url_link_list_.clear(); + // Rather than creating a new waypt on each read, tis format bizarrely + // recycles the same one, relying on waypt_dupe() above and then manually + // resetting fields. Weird. + wpt->url_link_list_.clear(); if (temp_route == NULL) { temp_route = route_head_alloc(); @@ -228,7 +228,7 @@ cst_data_read(void) if (strcmp(cin + 2, "note") == 0) { buff = gbfgetstr(fin); if (buff == NULL) { - buff = (char *) ""; + buff = (char*) ""; } line++; cin = lrtrim(buff); diff --git a/gpsbabel/csv_util.cc b/gpsbabel/csv_util.cc index c24f893d5..2fd9054fd 100644 --- a/gpsbabel/csv_util.cc +++ b/gpsbabel/csv_util.cc @@ -950,8 +950,8 @@ static long time_to_yyyymmdd(QDateTime t) { - QDate d = t.date(); - return d.year() * 10000 + d.month() * 100 + d.day(); + QDate d = t.date(); + return d.year() * 10000 + d.month() * 100 + d.day(); } static garmin_fs_t* @@ -1006,11 +1006,15 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp, wpt->notes = csv_stringtrim(s, "", 0); break; case XT_URL: - if (!link_) link_ = new UrlLink; + if (!link_) { + link_ = new UrlLink; + } link_->url_ = QString(s).trimmed(); break; case XT_URL_LINK_TEXT: - if (!link_) link_ = new UrlLink; + if (!link_) { + link_ = new UrlLink; + } link_->url_link_text_ = QString(s).trimmed(); break; case XT_ICON_DESCR: @@ -1197,11 +1201,11 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp, wpt->SetCreationTime(xml_parse_time(s)); break; case XT_NET_TIME: { -fatal("XT_NET_TIME can't have possibly ever worked."); + fatal("XT_NET_TIME can't have possibly ever worked."); // time_t tt = wpt->GetCreationTime(); // dotnet_time_to_time_t(atof(s), &tt, &wpt->microseconds); - } - break; + } + break; case XT_GEOCACHE_LAST_FOUND: waypt_alloc_gc_data(wpt)->last_found = yyyymmdd_to_time(s); break; @@ -1698,11 +1702,11 @@ xcsv_waypt_pr(const waypoint* wpt) } } break; - case XT_URL_LINK_TEXT: + case XT_URL_LINK_TEXT: if (wpt->HasUrlLink()) { - UrlLink l = wpt->GetUrlLink(); - snprintf(buff, sizeof(buff), fmp->printfc, - !l.url_link_text_.isEmpty() ? l.url_link_text_.toUtf8().data() : fmp->val); + UrlLink l = wpt->GetUrlLink(); + snprintf(buff, sizeof(buff), fmp->printfc, + !l.url_link_text_.isEmpty() ? l.url_link_text_.toUtf8().data() : fmp->val); } break; case XT_ICON_DESCR: @@ -1924,10 +1928,12 @@ xcsv_waypt_pr(const waypoint* wpt) writebuff(buff, fmp->printfc, TIMET_TO_EXCEL(wpt->GetCreationTime().toTime_t())); break; case XT_TIMET_TIME: - /* time as a time_t variable */ { + /* time as a time_t variable */ + { time_t tt = wpt->GetCreationTime().toTime_t(); - writebuff(buff, fmp->printfc, tt); } - break; + writebuff(buff, fmp->printfc, tt); + } + break; case XT_TIMET_TIME_MS: { /* time as a time_t variable in milliseconds */ char tbuf[24]; @@ -1956,7 +1962,7 @@ xcsv_waypt_pr(const waypoint* wpt) writetime(buff, sizeof buff, "%Y-%m-%dT%H:%M:%SZ", wpt->GetCreationTime(), true); break; case XT_ISO_TIME_MS: - strcpy(buff, wpt->GetCreationTime().toPrettyString().toUtf8().data()); + strcpy(buff, wpt->GetCreationTime().toPrettyString().toUtf8().data()); break; case XT_GEOCACHE_LAST_FOUND: writebuff(buff, fmp->printfc, time_to_yyyymmdd(wpt->gc_data->last_found)); diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index 6380c6941..80f2f1a4c 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -264,8 +264,9 @@ typedef enum { gc_small } geocache_container; -class utf_string{ - public: +class utf_string +{ +public: utf_string() : is_html(false) {}; @@ -273,8 +274,9 @@ class utf_string{ QString utfstring; }; -class geocache_data { - public: +class geocache_data +{ +public: geocache_data() : id(0), type(gt_unknown), @@ -333,8 +335,9 @@ typedef struct format_specific_data { fs_convert convert; } format_specific_data; -class gb_color { - public: +class gb_color +{ +public: gb_color() : bbggrr(-1), opacity(255) {} @@ -367,13 +370,14 @@ fs_xml* fs_xml_alloc(long type); * Structures and functions for multiple URLs per waypoint. */ -class UrlLink { - public: - UrlLink() { } - UrlLink(QString url) : +class UrlLink +{ +public: + UrlLink() { } + UrlLink(QString url) : url_(url) - { } - UrlLink(QString url, QString url_link_text) : + { } + UrlLink(QString url, QString url_link_text) : url_(url), url_link_text_(url_link_text) { } @@ -385,9 +389,10 @@ class UrlLink { /* * Misc bitfields inside struct waypoint; */ -class wp_flags { - public: - wp_flags() : +class wp_flags +{ +public: + wp_flags() : shortname_is_synthetic(0), cet_converted(0), fmt_use(0), @@ -421,8 +426,9 @@ class wp_flags { // things, though it's u nlikely to matter in practical terms. Don't use these // if a false positive would be deleterious. # -class global_trait { - public: +class global_trait +{ +public: global_trait() : trait_geocaches(0), trait_heartrate(0), @@ -451,35 +457,36 @@ const global_trait* get_traits(); * way to the target. */ -class waypoint { +class waypoint +{ +public: + waypoint() : + latitude(0), // These should probably use some invalid data, but + longitude(0), // it looks like we have code that relies on them being zero. + altitude(-99999999.0), + depth(0), + proximity(0), + shortname(NULL), + description(NULL), + notes(NULL), + route_priority(0), + hdop(0), + vdop(0), + pdop(0), + course(0), + speed(0), + fix(fix_unknown), + sat(-1), + heartrate(0), + cadence(0), + power(0), + temperature(0), + odometer_distance(0), + gc_data(NULL), + fs(NULL), + session(NULL), + extra_data(NULL) { } public: - waypoint() : - latitude(0), // These should probably use some invalid data, but - longitude(0), // it looks like we have code that relies on them being zero. - altitude(-99999999.0), - depth(0), - proximity(0), - shortname(NULL), - description(NULL), - notes(NULL), - route_priority(0), - hdop(0), - vdop(0), - pdop(0), - course(0), - speed(0), - fix(fix_unknown), - sat(-1), - heartrate(0), - cadence(0), - power(0), - temperature(0), - odometer_distance(0), - gc_data(NULL), - fs(NULL), - session(NULL), - extra_data(NULL) { } - public: QString CreationTimeXML() const; queue Q; /* Master waypoint q. Not for use by modules. */ @@ -526,20 +533,30 @@ public: /* TODO: UrlLink should probably move to a "real" class of its own. */ QList url_link_list_; - bool HasUrlLink() const {return !url_link_list_.isEmpty(); } - const UrlLink& GetUrlLink() const { return url_link_list_[0]; } - const QList GetUrlLinks() const { return url_link_list_; } - void AddUrlLink(const UrlLink l) { url_link_list_.push_back(l); } + bool HasUrlLink() const { + return !url_link_list_.isEmpty(); + } + const UrlLink& GetUrlLink() const { + return url_link_list_[0]; + } + const QList GetUrlLinks() const { + return url_link_list_; + } + void AddUrlLink(const UrlLink l) { + url_link_list_.push_back(l); + } wp_flags wpt_flags; QString icon_descr; gpsbabel::DateTime GetCreationTime() const { - return creation_time; + return creation_time; } - void SetCreationTime(gpsbabel::DateTime t) { creation_time = t; + void SetCreationTime(gpsbabel::DateTime t) { + creation_time = t; } - void SetCreationTime(time_t t) { creation_time = QDateTime::fromTime_t(t); + void SetCreationTime(time_t t) { + creation_time = QDateTime::fromTime_t(t); } void SetCreationTime(time_t t, int ms) { creation_time.setTime_t(t); @@ -581,8 +598,9 @@ public: void* extra_data; /* Extra data added by, say, a filter. */ }; -class route_head { - public: +class route_head +{ +public: route_head() : rte_name(NULL), rte_desc(NULL), @@ -918,7 +936,7 @@ void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3); void warning(const char*, ...) PRINTFLIKE(1, 2); void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3); -ff_vecs_t* find_vec(const char *, const char**); +ff_vecs_t* find_vec(const char*, const char**); void assign_option(const char* vecname, arglist_t* ap, const char* val); void disp_vec_options(const char* vecname, arglist_t* ap); void disp_vecs(void); diff --git a/gpsbabel/delbin.cc b/gpsbabel/delbin.cc index d5a59039c..18fccc694 100644 --- a/gpsbabel/delbin.cc +++ b/gpsbabel/delbin.cc @@ -134,7 +134,7 @@ static arglist_t delbin_args[] = { ARG_NOMINMAX }, {"hint_at_end", &opt_hint_at_end, "If true, geocache hint at end of text", NULL, ARGTYPE_BOOL, ARG_NOMINMAX }, - {"gcsym", &opt_gcsym, "If set to 0, prefer user-provided symbols over Groundspeaks ones for geocaches", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, (char *) "1" }, + {"gcsym", &opt_gcsym, "If set to 0, prefer user-provided symbols over Groundspeaks ones for geocaches", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, (char*) "1" }, ARG_TERMINATOR }; @@ -2787,7 +2787,7 @@ libusb_os_deinit(void) static unsigned libusb_os_packet_read(void* buf) { - int n = usb_interrupt_read(usb_handle, endpoint_in, (char *) buf, delbin_os_packet_size, 2000); + int n = usb_interrupt_read(usb_handle, endpoint_in, (char*) buf, delbin_os_packet_size, 2000); if (n < 0) { fatal(MYNAME ": %s\n", usb_strerror()); } diff --git a/gpsbabel/destinator.cc b/gpsbabel/destinator.cc index 8d7f43a02..277764c85 100644 --- a/gpsbabel/destinator.cc +++ b/gpsbabel/destinator.cc @@ -444,7 +444,7 @@ destinator_trkpt_disp(const waypoint* wpt) date = ((int)tm.tm_mday * 10000) + ((int)tm.tm_mon * 100) + tm.tm_year; gbfputint32(date, fout); milliseconds = ((int)tm.tm_hour * 10000) + - ((int)tm.tm_min * 100) + tm.tm_sec; + ((int)tm.tm_min * 100) + tm.tm_sec; milliseconds = (milliseconds * 1000) + (wpt->GetCreationTime().time().msec()); gbfputflt(milliseconds, fout); diff --git a/gpsbabel/dg-100.cc b/gpsbabel/dg-100.cc index 53ba3d2e3..d37a2ea74 100644 --- a/gpsbabel/dg-100.cc +++ b/gpsbabel/dg-100.cc @@ -271,8 +271,7 @@ process_gpsfile(uint8_t data[], route_head** track) if (latitude >= 100) { manual_point = 1; latitude -= 100; - } - else if (latitude <= -100) { + } else if (latitude <= -100) { manual_point = 1; latitude += 100; } @@ -297,8 +296,7 @@ process_gpsfile(uint8_t data[], route_head** track) if (manual_point) { waypt_add(wpt); - } - else { + } else { track_add_wpt(*track, wpt); } } diff --git a/gpsbabel/easygps.cc b/gpsbabel/easygps.cc index a7b30c18b..37759fadf 100644 --- a/gpsbabel/easygps.cc +++ b/gpsbabel/easygps.cc @@ -136,7 +136,7 @@ data_read(void) } } if (!link.url_.isEmpty() || !link.url_link_text_.isEmpty()) { - wpt_tmp->AddUrlLink(link); + wpt_tmp->AddUrlLink(link); } waypt_add(wpt_tmp); p = gbfgetc(file_in); diff --git a/gpsbabel/garmin.cc b/gpsbabel/garmin.cc index cc8e3cd25..0ec4a6398 100644 --- a/gpsbabel/garmin.cc +++ b/gpsbabel/garmin.cc @@ -633,11 +633,11 @@ lap_read_as_track(void) wpt->microseconds = 0; sprintf(tbuf, "#%d-0", index); - wpt->shortname = xstrdup(tbuf); + wpt->shortname = xstrdup(tbuf); sprintf(tbuf, "D:%f Cal:%d MS:%f AH:%d MH:%d AC:%d I:%d T:%d", array[i]->total_distance, array[i]->calories, array[i]->max_speed, array[i]->avg_heart_rate, array[i]->max_heart_rate, array[i]->avg_cadence, array[i]->intensity, array[i]->trigger_method); - wpt->description = xstrdup(tbuf); + wpt->description = xstrdup(tbuf); track_add_wpt(trk_head, wpt); } /*Allow even if no correct location, no skip if invalid */ @@ -661,7 +661,7 @@ lap_read_as_track(void) array[i]->total_distance, array[i]->calories, array[i]->max_speed, array[i]->avg_heart_rate, array[i]->max_heart_rate, array[i]->avg_cadence, array[i]->intensity, array[i]->trigger_method, array[i]->begin_lon, array[i]->begin_lat); - wpt->description = xstrdup(tbuf); + wpt->description = xstrdup(tbuf); track_add_wpt(trk_head, wpt); } diff --git a/gpsbabel/garmin_fs.cc b/gpsbabel/garmin_fs.cc index 86110f949..0b25bd53c 100644 --- a/gpsbabel/garmin_fs.cc +++ b/gpsbabel/garmin_fs.cc @@ -214,7 +214,7 @@ garmin_fs_xml_fprint(const waypoint* waypt, writer->writeStartElement("extensions"); writer->writeStartElement("gpxx:WaypointExtension"); writer->writeNamespace("http://www.garmin.com/xmlschemas/GpxExtensions/v3", - "gpxx"); + "gpxx"); if WAYPT_HAS(waypt, proximity) { writer->writeTextElement("gpxx:Proximity", QString::number(waypt->proximity, 'f', 6)); } @@ -339,7 +339,7 @@ garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatastr, waypoin if (! garmin_fs_merge_category(cdatastr, waypt)) { // There's nothing a user can really do about this (well, they could // create a gpsbabel.ini that mapped them to garmin category numbers - // but that feature is so obscure and used in so few outputs that + // but that feature is so obscure and used in so few outputs that // there's no reason to alarm the user. Just silently disregard // category names that don't map cleanly. // warning(MYNAME ": Unable to convert category \"%s\"!\n", cdatastr); diff --git a/gpsbabel/garmin_txt.cc b/gpsbabel/garmin_txt.cc index 10abf14c9..882fba899 100644 --- a/gpsbabel/garmin_txt.cc +++ b/gpsbabel/garmin_txt.cc @@ -610,7 +610,7 @@ write_waypt(const waypoint* wpt) print_string("%s\t", icon_descr); if (dynamic) { // sleaze alert: cast away constness. - xfree((char *) icon_descr); + xfree((char*) icon_descr); } print_string("%s\t", GMSD_GET(facility, "")); @@ -1197,13 +1197,13 @@ parse_waypoint(void) time_t ct; parse_date_and_time(str, &ct); wpt->SetCreationTime(ct); - } - break; + } + break; case 17: { UrlLink l(str); wpt->AddUrlLink(l); - } - break; + } + break; case 18: GMSD_SET(category, parse_categories(str)); break; @@ -1316,8 +1316,8 @@ parse_track_waypoint(void) time_t ct; parse_date_and_time(str, &ct); wpt->SetCreationTime(ct); - } - break; + } + break; case 3: if (parse_distance(str, &x, 1, MYNAME)) { wpt->altitude = x; diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index 093967699..23720b570 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -1259,7 +1259,7 @@ gbfputpstr(const char* s, gbfile* file) int gbfputpstr(const QString& s, gbfile* file) { - const char *t = xstrdup(s.toUtf8().data()); + const char* t = xstrdup(s.toUtf8().data()); int r = gbfputpstr(t, file); xfree(t); return r; diff --git a/gpsbabel/gbser_win.cc b/gpsbabel/gbser_win.cc index ac1cfacc0..b14b51f60 100644 --- a/gpsbabel/gbser_win.cc +++ b/gpsbabel/gbser_win.cc @@ -259,7 +259,7 @@ unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len) { gbser_handle* h = gbser__get_handle(handle); unsigned count = *len; - unsigned char* cp = (unsigned char *) *buf; + unsigned char* cp = (unsigned char*) *buf; if (count > h->inbuf_used) { count = h->inbuf_used; } @@ -357,7 +357,7 @@ int gbser_write(void* handle, const void* buf, unsigned len) { gbser_handle* h = gbser__get_handle(handle); DWORD nwritten; - const char* bp = (const char *) buf; + const char* bp = (const char*) buf; /* Not sure we need to spin here - but this'll work even if we don't */ while (len > 0) { if (!WriteFile(h->comport, bp, len, &nwritten, NULL)) { @@ -426,7 +426,7 @@ int gbser_read_line(void* handle, void* buf, unsigned len, unsigned ms, int eol, int discard) { - char* bp = (char *) buf; + char* bp = (char*) buf; unsigned pos = 0; hp_time tv; get_time(&tv); diff --git a/gpsbabel/gdb.cc b/gpsbabel/gdb.cc index e44c070d1..561fe8ec5 100644 --- a/gpsbabel/gdb.cc +++ b/gpsbabel/gdb.cc @@ -254,10 +254,10 @@ gdb_fread_cstr(gbfile* fin) static QString gdb_fread_cstr_as_qstr(gbfile* fin) { - char* result = gdb_fread_cstr(fin); - QString qresult = result; - xfree(result); - return qresult; + char* result = gdb_fread_cstr(fin); + QString qresult = result; + xfree(result); + return qresult; } static int @@ -407,7 +407,7 @@ gdb_write_cstr_list(const char* str) static void gdb_write_cstr_list(const QString& str) { - return gdb_write_cstr_list(str.toLatin1().data()); + return gdb_write_cstr_list(str.toLatin1().data()); } static void diff --git a/gpsbabel/geo.cc b/gpsbabel/geo.cc index fea6fa7f5..102027d2b 100644 --- a/gpsbabel/geo.cc +++ b/gpsbabel/geo.cc @@ -48,11 +48,11 @@ geocache_container wpt_container(const QString&); // Compensate for most of class waypt still using C strings and needing // copies anyway. -char * ShimString(const QString& s) +char* ShimString(const QString& s) { return xstrdup(s.toUtf8().data()); } -char * ShimString(const QStringRef& s) +char* ShimString(const QStringRef& s) { return xstrdup(s.toString().toUtf8().data()); } @@ -70,11 +70,11 @@ void GeoReadLoc() QStringRef tag_name = reader.name(); if (reader.tokenType()==QXmlStreamReader::StartElement) { if (tag_name == "waypoint") { - wpt = waypt_new(); - waypt_alloc_gc_data(wpt); - // There is no 'unknown' alt value and so many reference files have - // leaked it that we just paper over that here. - wpt->altitude = 0; + wpt = waypt_new(); + waypt_alloc_gc_data(wpt); + // There is no 'unknown' alt value and so many reference files have + // leaked it that we just paper over that here. + wpt->altitude = 0; } else if (tag_name == "name") { QXmlStreamAttributes a = reader.attributes(); wpt->shortname = ShimString(a.value("id")); @@ -87,7 +87,7 @@ void GeoReadLoc() wpt->icon_descr = reader.readElementText(); } else if (tag_name == "link") { QXmlStreamAttributes a = reader.attributes(); - waypt_add_url(wpt, + waypt_add_url(wpt, reader.readElementText(), a.value("text").toString()); } else if (tag_name == "difficulty") { wpt->gc_data->diff = reader.readElementText().toInt() * 10; @@ -100,7 +100,7 @@ void GeoReadLoc() if (reader.tokenType() == QXmlStreamReader::EndElement) { if (tag_name == "waypoint") { - waypt_add(wpt); + waypt_add(wpt); } } diff --git a/gpsbabel/google.cc b/gpsbabel/google.cc index 99ec30004..0e1ca469d 100644 --- a/gpsbabel/google.cc +++ b/gpsbabel/google.cc @@ -57,7 +57,7 @@ xg_tag_mapping google_map[] = { { NULL, (xg_cb_type)0, NULL } }; -void goog_script(const char* args, const QXmlStreamAttributes *unused) +void goog_script(const char* args, const QXmlStreamAttributes* unused) { if (args) { if (script) { @@ -68,7 +68,7 @@ void goog_script(const char* args, const QXmlStreamAttributes *unused) } } -void goog_points(const char* args, const QXmlStreamAttributes *unused) +void goog_points(const char* args, const QXmlStreamAttributes* unused) { if (args) { if (encoded_points) { @@ -79,7 +79,7 @@ void goog_points(const char* args, const QXmlStreamAttributes *unused) } } -void goog_levels(const char* args, const QXmlStreamAttributes *unused) +void goog_levels(const char* args, const QXmlStreamAttributes* unused) { if (args) { if (encoded_levels) { @@ -103,11 +103,11 @@ void goog_segment_s(const char* args, const QXmlStreamAttributes* attrv) QStringRef ptidx = attrv->value("pointIndex"); if (!ptidx.isEmpty()) { snprintf(goog_segname, sizeof(goog_segname), "\\%5.5x", - ptidx.toString().toUInt()); + ptidx.toString().toUInt()); } } -void goog_segment(const char* args, const QXmlStreamAttributes *unused) +void goog_segment(const char* args, const QXmlStreamAttributes* unused) { waypoint* wpt_tmp; @@ -151,7 +151,7 @@ void goog_td_s(const char* args, const QXmlStreamAttributes* attrv) snprintf(goog_segname, sizeof(goog_segname), "\\%5.5x", idstr.mid(idstr.lastIndexOf("_") + 1).toUInt() + - routecount[goog_segroute]); + routecount[goog_segroute]); } } @@ -200,7 +200,7 @@ static long decode_goog64(char** str) return result/2; } -void goog_poly_e(const char* args, const QXmlStreamAttributes *unused) +void goog_poly_e(const char* args, const QXmlStreamAttributes* unused) { long lat = 0; long lon = 0; diff --git a/gpsbabel/googledir.cc b/gpsbabel/googledir.cc index 18843feb9..4696a95ab 100644 --- a/gpsbabel/googledir.cc +++ b/gpsbabel/googledir.cc @@ -107,7 +107,7 @@ goog_poly_e(const char* args, const QXmlStreamAttributes* unused) char* str = encoded_points; route_head* routehead = route_head_alloc(); - if (strcmp (args, "overview_polyline") == 0) { + if (strcmp(args, "overview_polyline") == 0) { routehead->rte_name = (char*) xstrdup("overview"); routehead->rte_desc = (char*) xstrdup("Overview"); } else { diff --git a/gpsbabel/gopal.cc b/gpsbabel/gopal.cc index a0bd6522c..30f695458 100644 --- a/gpsbabel/gopal.cc +++ b/gpsbabel/gopal.cc @@ -314,7 +314,7 @@ gopal_read(void) speed=0; if (lastwpt !=NULL) { speed=3.6*radtometers(gcdist(RAD(lastwpt->latitude), RAD(lastwpt->longitude), RAD(wpt->latitude), RAD(wpt->longitude))) / - abs(wpt->creation_time.toTime_t() - lastwpt->GetCreationTime().toTime_t()); + abs(wpt->creation_time.toTime_t() - lastwpt->GetCreationTime().toTime_t()); //printf("speed line %d %lf \n",line,speed); } /* Error handling: in the tracklog of my device sometimes "jump" waypoints ;-) */ diff --git a/gpsbabel/grtcirc.cc b/gpsbabel/grtcirc.cc index c970dddf6..f2f5509d3 100644 --- a/gpsbabel/grtcirc.cc +++ b/gpsbabel/grtcirc.cc @@ -243,10 +243,9 @@ double linedistprj(double lat1, double lon1, * known to be positive. */ *prjlat = DEG(asin(yp)); - if(xp == 0 && zp == 0) { + if (xp == 0 && zp == 0) { *prjlon = 0; - } - else { + } else { *prjlon = DEG(atan2(zp, xp)); } *frac = d1/(d1 + d2); diff --git a/gpsbabel/grtcirc.h b/gpsbabel/grtcirc.h index 273657ace..7edf4f186 100644 --- a/gpsbabel/grtcirc.h +++ b/gpsbabel/grtcirc.h @@ -30,7 +30,7 @@ double linedistprj(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double* prjlat, double* prjlon, - double* frac ); + double* frac); double linedist(double lat1, double lon1, double lat2, double lon2, diff --git a/gpsbabel/gtm.cc b/gpsbabel/gtm.cc index 96c470dca..2680eee96 100644 --- a/gpsbabel/gtm.cc +++ b/gpsbabel/gtm.cc @@ -144,7 +144,8 @@ fwrite_string(gbfile* fd, const char* str) } } static void -fwrite_string(gbfile* fd, QString& str) { +fwrite_string(gbfile* fd, QString& str) +{ if (str.isEmpty()) { fwrite_integer(fd, 0); } else { @@ -318,13 +319,11 @@ static const int indatum_array[MAX_INDATUM_INDEX] = { void set_datum(int n) { indatum = -1; - if (n > 0 && n < MAX_INDATUM_INDEX) - { - indatum = indatum_array[n]; + if (n > 0 && n < MAX_INDATUM_INDEX) { + indatum = indatum_array[n]; } - if (indatum == -1) - { + if (indatum == -1) { warning(MYNAME ": Unsupported datum (%d), won't convert to WGS84\n", n); } } diff --git a/gpsbabel/gtrnctr.cc b/gpsbabel/gtrnctr.cc index a3abd5455..7554df77a 100644 --- a/gpsbabel/gtrnctr.cc +++ b/gpsbabel/gtrnctr.cc @@ -332,12 +332,12 @@ gtc_fake_hdr(void) } if (tdata->avg_hrt) { gtc_write_xml(1, "\n"); - gtc_write_xml(0, "%d\n", (int) (tdata->avg_hrt + 0.5)); + gtc_write_xml(0, "%d\n", (int)(tdata->avg_hrt + 0.5)); gtc_write_xml(-1,"\n"); } if (tdata->max_hrt) { gtc_write_xml(1, "\n"); - gtc_write_xml(0, "%d\n", (int) (tdata->max_hrt + 0.5)); + gtc_write_xml(0, "%d\n", (int)(tdata->max_hrt + 0.5)); gtc_write_xml(-1,"\n"); } if (tdata->avg_cad) { @@ -374,9 +374,9 @@ gtc_act_hdr(const route_head* rte) route_disp(rte, gtc_study_lap); if (gtc_least_time.isValid()) { gtc_write_xml(0, "%s\n", - CSTR(gtc_least_time.toPrettyString())); + CSTR(gtc_least_time.toPrettyString())); gtc_write_xml(1, "\n", - CSTR(gtc_least_time.toPrettyString())); + CSTR(gtc_least_time.toPrettyString())); } else { gtc_write_xml(1, "\n"); } @@ -583,7 +583,7 @@ gtc_wpt_pnt_e(const char* args, const QXmlStreamAttributes* unusedd) if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) { /* Add the begin position of a CourseLap as a waypoint. */ - char *cbuf; + char* cbuf; xasprintf(&cbuf, "LAP%03d", lap_ct); wpt_tmp->shortname = cbuf; waypt_add(wpt_tmp); diff --git a/gpsbabel/height.h b/gpsbabel/height.h index c86f56c36..d09bb77c8 100644 --- a/gpsbabel/height.h +++ b/gpsbabel/height.h @@ -21,7 +21,7 @@ #define GEOID_SCALE 1.0 #define GEOID_ROW 181 #define GEOID_COL 361 -static const int8_t geoid_delta[GEOID_COL*GEOID_ROW]= { +static const int8_t geoid_delta[GEOID_COL* GEOID_ROW]= { /* -180,-179,-178,-177,-176,-175,-174,-173,-172,-171,-170,-169,-168,-167,-166,-165,-164,-163,-162,-161,-160,-159,-158,-157,-156,-155,-154,-153,-152,-151,-150,-149,-148,-147,-146,-145,-144,-143,-142,-141,-140,-139,-138,-137,-136,-135,-134,-133,-132,-131,-130,-129,-128,-127,-126,-125,-124,-123,-122,-121,-120,-119,-118,-117,-116,-115,-114,-113,-112,-111,-110,-109,-108,-107,-106,-105,-104,-103,-102,-101,-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180 */ /* -90.0 */ -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, /* -89.0 */ -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, diff --git a/gpsbabel/jtr.cc b/gpsbabel/jtr.cc index 9fb7a7e7f..7452669b5 100644 --- a/gpsbabel/jtr.cc +++ b/gpsbabel/jtr.cc @@ -37,7 +37,7 @@ arglist_t jtr_args[] = { }; static gbfile* fin, *fout; -static QHash trkpts; +static QHash trkpts; static time_t jtr_parse_time(const char* str, struct tm* tm, int* milli) diff --git a/gpsbabel/kml.cc b/gpsbabel/kml.cc index 70eca5780..91e3ce501 100644 --- a/gpsbabel/kml.cc +++ b/gpsbabel/kml.cc @@ -281,7 +281,7 @@ void wpt_e(const char* args, const QXmlStreamAttributes* unused) if (wpt_tmp_queued) { waypt_add(wpt_tmp); } else { - waypt_free(wpt_tmp); + waypt_free(wpt_tmp); } wpt_tmp_queued = 0; } @@ -585,7 +585,7 @@ static void kml_write_bitmap_style(kml_point_type pt_type, const char* bitmap, static void kml_output_timestamp(const waypoint* waypointp) { QString time_string = waypointp->CreationTimeXML(); - if(!time_string.isEmpty()) { + if (!time_string.isEmpty()) { writer->writeStartElement("TimeStamp"); AUTOFORMATTING_OFF(af); // FIXME: we turn off autoformatting just to match old writer test references. writer->writeTextElement("when", time_string); @@ -760,15 +760,15 @@ void kml_write_coordinates(const waypoint* waypointp) { if (kml_altitude_known(waypointp)) { writer->writeTextElement("coordinates", - QString::number(waypointp->longitude, 'f', 6) + QString(",") + - QString::number(waypointp->latitude, 'f', 6) + QString(",") + - QString::number(waypointp->altitude, 'f', 2) - ); + QString::number(waypointp->longitude, 'f', 6) + QString(",") + + QString::number(waypointp->latitude, 'f', 6) + QString(",") + + QString::number(waypointp->altitude, 'f', 2) + ); } else { writer->writeTextElement("coordinates", - QString::number(waypointp->longitude, 'f', 6) + QString(",") + - QString::number(waypointp->latitude, 'f', 6) - ); + QString::number(waypointp->longitude, 'f', 6) + QString(",") + + QString::number(waypointp->latitude, 'f', 6) + ); } } @@ -855,7 +855,7 @@ static void kml_output_description(const waypoint* pt) */ if (pt->GetCreationTime().isValid()) { QString time_string = pt->CreationTimeXML(); - if(!time_string.isEmpty()) { + if (!time_string.isEmpty()) { kml_td(hwriter, QString("Time: %1 ").arg(time_string)); } } @@ -869,14 +869,13 @@ static void kml_output_description(const waypoint* pt) static void kml_recompute_time_bounds(const waypoint* waypointp) { - if (waypointp->GetCreationTime().isValid()) - { - if(!(kml_time_min.isValid()) || + if (waypointp->GetCreationTime().isValid()) { + if (!(kml_time_min.isValid()) || (waypointp->GetCreationTime() < kml_time_min)) { kml_time_min = waypointp->GetCreationTime(); } if (!(kml_time_max.isValid()) || - (waypointp->GetCreationTime() > kml_time_max )) { + (waypointp->GetCreationTime() > kml_time_max)) { kml_time_max = waypointp->GetCreationTime(); } } @@ -981,12 +980,12 @@ static void kml_output_tailer(const route_head* header) if (rotate_colors) { kml_step_color(); writer->writeTextElement("color", QString("%1%2") - .arg(kml_color_sequencer.color.opacity, 2, 16, QChar('0')).arg(kml_color_sequencer.color.bbggrr, 6, 16, QChar('0'))); + .arg(kml_color_sequencer.color.opacity, 2, 16, QChar('0')).arg(kml_color_sequencer.color.bbggrr, 6, 16, QChar('0'))); writer->writeTextElement("width", opt_line_width); } else { if (header->line_color.bbggrr >= 0) { writer->writeTextElement("color", QString("%1%2") - .arg(header->line_color.opacity, 2, 16, QChar('0')).arg(header->line_color.bbggrr, 6, 16, QChar('0'))); + .arg(header->line_color.opacity, 2, 16, QChar('0')).arg(header->line_color.bbggrr, 6, 16, QChar('0'))); } if (header->line_width >= 0) { writer->writeTextElement("width", QString::number(header->line_width)); @@ -1015,13 +1014,13 @@ static void kml_output_tailer(const route_head* header) } if (kml_altitude_known(tpt)) { writer->writeCharacters(QString::number(tpt->longitude, 'f', 6) + QString(",") + - QString::number(tpt->latitude, 'f', 6) + QString(",") + - QString::number(tpt->altitude, 'f', 2) + QString("\n") - ); + QString::number(tpt->latitude, 'f', 6) + QString(",") + + QString::number(tpt->altitude, 'f', 2) + QString("\n") + ); } else { writer->writeCharacters(QString::number(tpt->longitude, 'f', 6) + QString(",") + - QString::number(tpt->latitude, 'f', 6) + QString("\n") - ); + QString::number(tpt->latitude, 'f', 6) + QString("\n") + ); } } writer->writeEndElement(); // Close coordinates tag @@ -1519,9 +1518,9 @@ static void kml_waypt_pr(const waypoint* waypointp) if (realtime_positioning) { writer->wrteStartTag("LookAt"); writer->writeTextElement("longitude", QString::number(waypointp->longitude, 'f', 6); - writer->writeTextElement("latitude", QString::number(waypointp->latitude, 'f', 6); - writer->writeTextElement("altitude", "1000"); - writer->writeEndElement(); // Close LookAt tag + writer->writeTextElement("latitude", QString::number(waypointp->latitude, 'f', 6); + writer->writeTextElement("altitude", "1000"); + writer->writeEndElement(); // Close LookAt tag } #endif @@ -1631,26 +1630,26 @@ static void kml_mt_simple_array(const route_head* header, QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint* wpt = (waypoint *) elem; + waypoint* wpt = (waypoint*) elem; switch (member) { - case fld_power: - writer->writeTextElement("gx:value", QString::number(wpt->power, 'f', 1)); - break; - case fld_cadence: - writer->writeTextElement("gx:value", QString::number(wpt->cadence)); - break; - case fld_depth: - writer->writeTextElement("gx:value", QString::number(wpt->depth, 'f', 1)); - break; - case fld_heartrate: - writer->writeTextElement("gx:value", QString::number(wpt->heartrate)); - break; - case fld_temperature: - writer->writeTextElement("gx:value", QString::number(wpt->temperature, 'f', 1)); - break; - default: - fatal("Bad member type"); + case fld_power: + writer->writeTextElement("gx:value", QString::number(wpt->power, 'f', 1)); + break; + case fld_cadence: + writer->writeTextElement("gx:value", QString::number(wpt->cadence)); + break; + case fld_depth: + writer->writeTextElement("gx:value", QString::number(wpt->depth, 'f', 1)); + break; + case fld_heartrate: + writer->writeTextElement("gx:value", QString::number(wpt->heartrate)); + break; + case fld_temperature: + writer->writeTextElement("gx:value", QString::number(wpt->temperature, 'f', 1)); + break; + default: + fatal("Bad member type"); } } writer->writeEndElement(); // Close SimpleArrayData tag @@ -1727,15 +1726,15 @@ static void kml_mt_hdr(const route_head* header) if (kml_altitude_known(tpt)) { writer->writeTextElement("gx:coord", - QString::number(tpt->longitude, 'f', 6) + QString(" ") + - QString::number(tpt->latitude, 'f', 6) + QString(" ") + - QString::number(tpt->altitude, 'f', 2) - ); + QString::number(tpt->longitude, 'f', 6) + QString(" ") + + QString::number(tpt->latitude, 'f', 6) + QString(" ") + + QString::number(tpt->altitude, 'f', 2) + ); } else { writer->writeTextElement("gx:coord", - QString::number(tpt->longitude, 'f', 6) + QString(" ") + - QString::number(tpt->latitude, 'f', 6) - ); + QString::number(tpt->longitude, 'f', 6) + QString(" ") + + QString::number(tpt->latitude, 'f', 6) + ); } // Capture interesting traits to see if we need to do an ExtendedData @@ -1763,20 +1762,25 @@ static void kml_mt_hdr(const route_head* header) writer->writeStartElement("SchemaData"); writer->writeAttribute("schemaUrl", "#schema"); - if (has_cadence) + if (has_cadence) { kml_mt_simple_array(header, kmt_cadence, fld_cadence); + } - if (has_depth) + if (has_depth) { kml_mt_simple_array(header, kmt_depth, fld_depth); + } - if (has_heartrate) + if (has_heartrate) { kml_mt_simple_array(header, kmt_heartrate, fld_heartrate); + } - if (has_temperature) + if (has_temperature) { kml_mt_simple_array(header, kmt_temperature, fld_temperature); + } - if (has_power) + if (has_power) { kml_mt_simple_array(header, kmt_power, fld_power); + } writer->writeEndElement(); // Close SchemaData tag writer->writeEndElement(); // Close ExtendedData tag diff --git a/gpsbabel/lowranceusr4.cc b/gpsbabel/lowranceusr4.cc index 4dc8f1184..e37d3c2d7 100644 --- a/gpsbabel/lowranceusr4.cc +++ b/gpsbabel/lowranceusr4.cc @@ -46,7 +46,7 @@ static int waypt_uid; static int route_uid; static int track_uid; -static waypoint **waypt_table; +static waypoint** waypt_table; static int waypt_table_sz, waypt_table_ct; static char* opt_title; @@ -108,7 +108,7 @@ lowranceusr4_readstr(char* buf, const int maxlen, gbfile* file, int bytes_per_ch } static void -lowranceusr4_writestr(char *buf, gbfile *file, unsigned int bytes_per_char) +lowranceusr4_writestr(char* buf, gbfile* file, unsigned int bytes_per_char) { unsigned int len = 0; @@ -214,7 +214,7 @@ static time_t lowranceusr4_get_timestamp(int jd_number, time_t t) { int a, b, c, d, e, m; - struct tm *ptm, ntm; + struct tm* ptm, ntm; time_t out; /* get UTC time from time_t */ @@ -249,24 +249,24 @@ lowranceusr4_jd_from_timestamp(time_t t) static void -lowranceusr4_copy_fsdata(lowranceusr4_fsdata **dest, lowranceusr4_fsdata *src) +lowranceusr4_copy_fsdata(lowranceusr4_fsdata** dest, lowranceusr4_fsdata* src) { - *dest = (lowranceusr4_fsdata *)xmalloc(sizeof(*src)); - **dest = *src; + *dest = (lowranceusr4_fsdata*)xmalloc(sizeof(*src)); + ** dest = *src; (*dest)->fs.next = NULL; } static void -lowranceusr4_free_fsdata(void *fsdata) +lowranceusr4_free_fsdata(void* fsdata) { xfree(fsdata); } static -lowranceusr4_fsdata * +lowranceusr4_fsdata* lowranceusr4_alloc_fsdata(void) { - lowranceusr4_fsdata *fsdata = (lowranceusr4_fsdata*) xcalloc(sizeof(*fsdata), 1); + lowranceusr4_fsdata* fsdata = (lowranceusr4_fsdata*) xcalloc(sizeof(*fsdata), 1); fsdata->fs.type = FS_LOWRANCEUSR4; fsdata->fs.copy = (fs_copy) lowranceusr4_copy_fsdata; fsdata->fs.destroy = lowranceusr4_free_fsdata; @@ -284,7 +284,7 @@ lowranceusr4_alloc_fsdata(void) /* make waypoint shortnames unique */ static char -same_points(const waypoint *A, const waypoint *B) +same_points(const waypoint* A, const waypoint* B) { return ( /* !!! We are case-sensitive !!! */ (strcmp(A->shortname, B->shortname) == 0) && @@ -293,13 +293,13 @@ same_points(const waypoint *A, const waypoint *B) } static void -register_waypt(const waypoint *ref) +register_waypt(const waypoint* ref) { int i; - waypoint *wpt = (waypoint *) ref; + waypoint* wpt = (waypoint*) ref; for (i = 0; i < waypt_table_ct; i++) { - waypoint *cmp = waypt_table[i]; + waypoint* cmp = waypt_table[i]; if (same_points(wpt, cmp)) { return; @@ -320,18 +320,18 @@ register_waypt(const waypoint *ref) wpt->shortname, wpt->description, waypt_table_ct); } - waypt_table[waypt_table_ct] = (waypoint *)wpt; + waypt_table[waypt_table_ct] = (waypoint*)wpt; waypt_table_ct++; } /* end borrowed from raymarine.c */ static int -lowranceusr4_find_waypt_index(const waypoint *wpt) +lowranceusr4_find_waypt_index(const waypoint* wpt) { int i; for (i = 0; i < waypt_table_ct; ++i) { - if (same_points(wpt, (const waypoint *)waypt_table[i])) { + if (same_points(wpt, (const waypoint*)waypt_table[i])) { return i; } } @@ -358,8 +358,8 @@ lowranceusr4_parse_waypoints(void) waypoint* wpt_tmp; wpt_tmp = waypt_new(); - lowranceusr4_fsdata *fsdata = lowranceusr4_alloc_fsdata(); - fs_chain_add(&(wpt_tmp->fs), (format_specific_data *) fsdata); + lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata(); + fs_chain_add(&(wpt_tmp->fs), (format_specific_data*) fsdata); /* read/parse waypoint, with fields as follows (taken mostly from http://lowranceusrv4togpxconverter.blogspot.com/): @@ -442,7 +442,7 @@ lowranceusr4_parse_waypoints(void) // or set it. if (create_date > 2440587) { wpt_tmp->SetCreationTime(lowranceusr4_get_timestamp(create_date, - create_time)); + create_time)); } /* Unused byte */ @@ -471,18 +471,17 @@ lowranceusr4_parse_waypoints(void) static waypoint* lowranceusr4_find_waypt(int uid_unit, int uid_seq_low, int uid_seq_high) { - queue *elem, *tmp; - waypoint *waypointp; - lowranceusr4_fsdata *fs = NULL; + queue* elem, *tmp; + waypoint* waypointp; + lowranceusr4_fsdata* fs = NULL; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; - fs = (lowranceusr4_fsdata *) fs_chain_find(waypointp->fs, FS_LOWRANCEUSR4); + waypointp = (waypoint*) elem; + fs = (lowranceusr4_fsdata*) fs_chain_find(waypointp->fs, FS_LOWRANCEUSR4); if (fs && fs->uid_unit == uid_unit && fs->uid_seq_low == uid_seq_low && - fs->uid_seq_high == uid_seq_high) - { + fs->uid_seq_high == uid_seq_high) { return waypointp; } } @@ -514,8 +513,8 @@ lowranceusr4_parse_routes(void) route_add_head(rte_head); rte_head->rte_num = i+1; - lowranceusr4_fsdata *fsdata = lowranceusr4_alloc_fsdata(); - fs_chain_add(&(rte_head->fs), (format_specific_data *) fsdata); + lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata(); + fs_chain_add(&(rte_head->fs), (format_specific_data*) fsdata); /* read/parse route, with fields as follows (taken mostly from http://lowranceusrv4togpxconverter.blogspot.com/): @@ -591,8 +590,8 @@ lowranceusr4_parse_trails(void) trk_head->rte_num = ++trk_num; track_add_head(trk_head); - lowranceusr4_fsdata *fsdata = lowranceusr4_alloc_fsdata(); - fs_chain_add(&(trk_head->fs), (format_specific_data *) fsdata); + lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata(); + fs_chain_add(&(trk_head->fs), (format_specific_data*) fsdata); /* read/parse trail, with fields as follows (taken mostly from http://lowranceusrv4togpxconverter.blogspot.com/): @@ -849,7 +848,7 @@ lowranceusr4_write_waypoints(void) printf(MYNAME " writing out waypt %d (%s - %s)\n", i, waypt_table[i]->shortname, waypt_table[i]->description); } - lowranceusr4_waypt_disp((const waypoint *)waypt_table[i]); + lowranceusr4_waypt_disp((const waypoint*)waypt_table[i]); } } @@ -1010,7 +1009,7 @@ data_write(void) short int MajorVersion, MinorVersion; int DataStreamVersion; time_t now; - struct tm *now_tm; + struct tm* now_tm; char buf[256]; setshort_length(mkshort_handle, 15); diff --git a/gpsbabel/maggeo.cc b/gpsbabel/maggeo.cc index d68d12659..1089d1653 100644 --- a/gpsbabel/maggeo.cc +++ b/gpsbabel/maggeo.cc @@ -199,7 +199,7 @@ static QDateTime maggeo_parsedate(char* dmy) int d = date.mid(0,2).toInt(); int m = date.mid(2,2).toInt(); int y = date.mid(4,3).toInt(); - QDateTime r(QDate (y + 1900, m, d)); + QDateTime r(QDate(y + 1900, m, d)); return r; } diff --git a/gpsbabel/magproto.cc b/gpsbabel/magproto.cc index 454a8d7cf..220f480f7 100644 --- a/gpsbabel/magproto.cc +++ b/gpsbabel/magproto.cc @@ -1187,7 +1187,7 @@ mag_find_token_from_descr(const QString& icon) } for (i = icon_mapping; i->token; i++) { - if (icon.compare(i->icon, Qt::CaseInsensitive) == 0) { + if (icon.compare(i->icon, Qt::CaseInsensitive) == 0) { return i->token; } } diff --git a/gpsbabel/main.cc b/gpsbabel/main.cc index 938fd1b75..8d922ce46 100644 --- a/gpsbabel/main.cc +++ b/gpsbabel/main.cc @@ -717,7 +717,6 @@ main(int argc, char* argv[]) ovecs->position_ops.wr_deinit(); } exit(0); -printf("early\n"); } diff --git a/gpsbabel/mmo.cc b/gpsbabel/mmo.cc index c9fff1655..08bb085c3 100644 --- a/gpsbabel/mmo.cc +++ b/gpsbabel/mmo.cc @@ -106,7 +106,7 @@ static route_head* mmo_rte; static QHash category_names; static QHash icons; -static QHash objects; +static QHash objects; static QHash mmobjects; typedef struct mmo_icon_mapping_s { @@ -187,7 +187,7 @@ mmo_readstr(void) len = (unsigned)gbfgetc(fin); if (len > 0) { unsigned int ii, jj, ch, resbytes=0; - res = (char *) xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion + res = (char*) xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion for (ii=0; iiname) { xfree(data->name); @@ -1031,7 +1031,7 @@ mmo_rd_deinit(void) icons.clear(); - foreach (int k, objects.keys()) { + foreach(int k, objects.keys()) { mmo_free_object(objects.value(k)); } objects.clear(); @@ -1481,7 +1481,7 @@ mmo_wr_deinit(void) mmobjects.clear(); category_names.clear(); - foreach (int k, objects.keys()) { + foreach(int k, objects.keys()) { mmo_free_object(objects.value(k)); } objects.clear(); diff --git a/gpsbabel/mtk_logger.cc b/gpsbabel/mtk_logger.cc index 9fbdda485..d1f4bc004 100644 --- a/gpsbabel/mtk_logger.cc +++ b/gpsbabel/mtk_logger.cc @@ -1547,8 +1547,8 @@ static void file_read(void) // Tobias Verbree reports that an M-12ee is like a 245. if (memcmp(&buf[i], "HOLUXM1200", 10) == 0) { - dbg(2, "Detected Holux HOLUXM1200 !\n"); - holux245_init(); + dbg(2, "Detected Holux HOLUXM1200 !\n"); + holux245_init(); } // skip the 4 spaces that may occur on every device diff --git a/gpsbabel/navicache.cc b/gpsbabel/navicache.cc index 1061a7de1..78655c7f5 100644 --- a/gpsbabel/navicache.cc +++ b/gpsbabel/navicache.cc @@ -97,7 +97,8 @@ nav_rd_init(const char* fname) } static void -NaviReadCache(const QXmlStreamReader& reader) { +NaviReadCache(const QXmlStreamReader& reader) +{ const QXmlStreamAttributes a = reader.attributes(); waypoint* wpt_tmp = waypt_new(); geocache_data* gc_data; @@ -185,8 +186,8 @@ nav_read(void) reader.setDevice(&file); while (!reader.atEnd()) { - if (reader.name() == "CacheDetails" && - reader.tokenType() == QXmlStreamReader::StartElement) { + if (reader.name() == "CacheDetails" && + reader.tokenType() == QXmlStreamReader::StartElement) { NaviReadCache(reader); } reader.readNextStartElement(); diff --git a/gpsbabel/navilink.cc b/gpsbabel/navilink.cc index dcbed7e8d..9b73df531 100644 --- a/gpsbabel/navilink.cc +++ b/gpsbabel/navilink.cc @@ -742,11 +742,12 @@ serial_write_route_end(const route_head* route) unsigned src; unsigned sr; unsigned char id[1]; - const char *rte_name; + const char* rte_name; rte_name = route->rte_name; - if (rte_name == NULL) + if (rte_name == NULL) { rte_name = "NO NAME"; + } if (route_id_ptr > MAX_ROUTE_LENGTH) { fatal(MYNAME ": Route %s too long\n", route->rte_name); } diff --git a/gpsbabel/osm.cc b/gpsbabel/osm.cc index fa27219e7..75d31a896 100644 --- a/gpsbabel/osm.cc +++ b/gpsbabel/osm.cc @@ -583,8 +583,8 @@ osm_way(const char* args, const QXmlStreamAttributes* attrv) rte = route_head_alloc(); if (attrv->hasAttribute("id")) { - xasprintf(&rte->rte_desc, "osm-id %s", - attrv->value("id").toString().toUtf8().constData()); + xasprintf(&rte->rte_desc, "osm-id %s", + attrv->value("id").toString().toUtf8().constData()); } } @@ -689,7 +689,7 @@ osm_init_icons(void) for (i = 0; osm_icon_mappings[i].value; i++) { icons.insert(QString::fromUtf8(osm_icon_mappings[i].icon), - &osm_icon_mappings[i]); + &osm_icon_mappings[i]); } } @@ -757,9 +757,9 @@ static QString osm_name_from_wpt(const waypoint* wpt) { QString name = QString("%1\01%2\01%3") - .arg((wpt->shortname) ? wpt->shortname : "") - .arg(wpt->latitude) - .arg(wpt->longitude); + .arg((wpt->shortname) ? wpt->shortname : "") + .arg(wpt->latitude) + .arg(wpt->longitude); return name; } diff --git a/gpsbabel/ozi.cc b/gpsbabel/ozi.cc index 5f670dd2e..736027867 100644 --- a/gpsbabel/ozi.cc +++ b/gpsbabel/ozi.cc @@ -39,28 +39,28 @@ typedef struct { } ozi_fsdata; -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static short_handle mkshort_handle; -static route_head *trk_head; -static route_head *rte_head; +static route_head* trk_head; +static route_head* rte_head; static int track_out_count; static int route_out_count; static int route_wpt_count; static int new_track; -static char *snlenopt = NULL; -static char *snwhiteopt = NULL; -static char *snupperopt = NULL; -static char *snuniqueopt = NULL; -static char *wptfgcolor = NULL; -static char *wptbgcolor = NULL; -static char *pack_opt = NULL; +static char* snlenopt = NULL; +static char* snwhiteopt = NULL; +static char* snupperopt = NULL; +static char* snuniqueopt = NULL; +static char* wptfgcolor = NULL; +static char* wptbgcolor = NULL; +static char* pack_opt = NULL; static int datum; -static char *proximityarg = NULL; +static char* proximityarg = NULL; static double proximity; -static char *altunit_opt; -static char *proxunit_opt; +static char* altunit_opt; +static char* proxunit_opt; static char altunit; static char proxunit; static double alt_scale; @@ -113,28 +113,28 @@ arglist_t ozi_args[] = { static gpsdata_type ozi_objective; -static char *ozi_ofname = NULL; +static char* ozi_ofname = NULL; static void -ozi_copy_fsdata(ozi_fsdata **dest, ozi_fsdata *src) +ozi_copy_fsdata(ozi_fsdata** dest, ozi_fsdata* src) { /* No strings to mess with. Straight forward copy. */ - *dest = (ozi_fsdata *)xmalloc(sizeof(*src)); - **dest = *src; + *dest = (ozi_fsdata*)xmalloc(sizeof(*src)); + ** dest = *src; (*dest)->fs.next = NULL; } static void -ozi_free_fsdata(void *fsdata) +ozi_free_fsdata(void* fsdata) { xfree(fsdata); } static -ozi_fsdata * +ozi_fsdata* ozi_alloc_fsdata(void) { - ozi_fsdata *fsdata = (ozi_fsdata*) xcalloc(sizeof(*fsdata), 1); + ozi_fsdata* fsdata = (ozi_fsdata*) xcalloc(sizeof(*fsdata), 1); fsdata->fs.type = FS_OZI; fsdata->fs.copy = (fs_copy) ozi_copy_fsdata; fsdata->fs.destroy = ozi_free_fsdata; @@ -148,7 +148,7 @@ ozi_alloc_fsdata(void) } void -ozi_get_time_str(const waypoint *waypointp, char *buff, gbsize_t buffsz) +ozi_get_time_str(const waypoint* waypointp, char* buff, gbsize_t buffsz) { if (waypointp->creation_time.isValid()) { double time = (waypt_time(waypointp) / SECONDS_PER_DAY) + DAYS_SINCE_1990; @@ -159,18 +159,18 @@ ozi_get_time_str(const waypoint *waypointp, char *buff, gbsize_t buffsz) } void -ozi_set_time_str(const char *str, waypoint *waypointp) +ozi_set_time_str(const char* str, waypoint* waypointp) { double ozi_time = atof(str); - if(ozi_time > DAYS_SINCE_1990) { + if (ozi_time > DAYS_SINCE_1990) { waypointp->SetCreationTime((ozi_time - DAYS_SINCE_1990) * SECONDS_PER_DAY, lround(1000.0 * (ozi_time - (int) ozi_time))); } } static void -ozi_convert_datum(waypoint *wpt) +ozi_convert_datum(waypoint* wpt) { if (datum != DATUM_WGS84) { double lat, lon, alt; @@ -182,10 +182,10 @@ ozi_convert_datum(waypoint *wpt) } static void -ozi_openfile(char *fname) +ozi_openfile(char* fname) { - char *c, *cx, *tmpname; - const char *ozi_extensions[] = {0, "plt", "wpt", "rte"}; + char* c, *cx, *tmpname; + const char* ozi_extensions[] = {0, "plt", "wpt", "rte"}; char buff[32]; /* if we're doing multi-track output, sequence the filenames like: @@ -232,9 +232,9 @@ ozi_openfile(char *fname) } static void -ozi_track_hdr(const route_head * rte) +ozi_track_hdr(const route_head* rte) { - static const char *ozi_trk_header = + static const char* ozi_trk_header = "OziExplorer Track Point File Version 2.1\r\n" "WGS 84\r\n" "Altitude is in %s\r\n" @@ -254,7 +254,7 @@ ozi_track_hdr(const route_head * rte) } static void -ozi_track_disp(const waypoint * waypointp) +ozi_track_disp(const waypoint* waypointp) { double alt; char ozi_time[16]; @@ -275,7 +275,7 @@ ozi_track_disp(const waypoint * waypointp) } static void -ozi_track_tlr(const route_head * rte) +ozi_track_tlr(const route_head* rte) { } @@ -286,9 +286,9 @@ ozi_track_pr() } static void -ozi_route_hdr(const route_head * rte) +ozi_route_hdr(const route_head* rte) { - static const char *ozi_route_header = + static const char* ozi_route_header = "OziExplorer Route File Version 1.0\r\n" "WGS 84\r\n" "Reserved 1\r\n" @@ -322,7 +322,7 @@ ozi_route_hdr(const route_head * rte) } static void -ozi_route_disp(const waypoint * waypointp) +ozi_route_disp(const waypoint* waypointp) { double alt; char ozi_time[16]; @@ -370,7 +370,7 @@ ozi_route_disp(const waypoint * waypointp) } static void -ozi_route_tlr(const route_head * rte) +ozi_route_tlr(const route_head* rte) { } @@ -418,7 +418,7 @@ ozi_init_units(const int direction) /* 0 = in; 1 = out */ } static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); @@ -435,7 +435,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { /* At this point, we have no idea whether we'll be writing waypoint, @@ -443,7 +443,7 @@ wr_init(const char *fname) * we're actually ready to write. */ - ozi_ofname = (char *)fname; + ozi_ofname = (char*)fname; mkshort_handle = mkshort_new_handle(); @@ -487,7 +487,7 @@ wr_deinit(void) } static void -ozi_parse_waypt(int field, char *str, waypoint * wpt_tmp, ozi_fsdata *fsdata) +ozi_parse_waypt(int field, char* str, waypoint* wpt_tmp, ozi_fsdata* fsdata) { double alt; @@ -582,7 +582,7 @@ ozi_parse_waypt(int field, char *str, waypoint * wpt_tmp, ozi_fsdata *fsdata) } static void -ozi_parse_track(int field, char *str, waypoint * wpt_tmp, char *trk_name) +ozi_parse_track(int field, char* str, waypoint* wpt_tmp, char* trk_name) { double alt; @@ -628,7 +628,7 @@ ozi_parse_track(int field, char *str, waypoint * wpt_tmp, char *trk_name) } static void -ozi_parse_routepoint(int field, char *str, waypoint * wpt_tmp) +ozi_parse_routepoint(int field, char* str, waypoint* wpt_tmp) { if (*str == '\0') { return; @@ -688,7 +688,7 @@ ozi_parse_routepoint(int field, char *str, waypoint * wpt_tmp) } static void -ozi_parse_routeheader(int field, char *str, waypoint * wpt_tmp) +ozi_parse_routeheader(int field, char* str, waypoint* wpt_tmp) { switch (field) { @@ -720,10 +720,10 @@ ozi_parse_routeheader(int field, char *str, waypoint * wpt_tmp) static void data_read(void) { - char *buff; - char *s = NULL; - char *trk_name = NULL; - waypoint *wpt_tmp; + char* buff; + char* s = NULL; + char* trk_name = NULL; + waypoint* wpt_tmp; int i; int linecount = 0; @@ -754,7 +754,7 @@ data_read(void) } } else if (linecount == 3) { if (case_ignore_strncmp(buff, "Altitude is in ", 15) == 0) { - char *unit = &buff[15]; + char* unit = &buff[15]; if (case_ignore_strncmp(unit, "Feet", 4) == 0) { altunit = 'f'; alt_scale = FEET_TO_METERS(1.0); @@ -779,7 +779,7 @@ data_read(void) if ((strlen(buff)) && (strstr(buff, ",") != NULL)) { bool ozi_fsdata_used = false; - ozi_fsdata *fsdata = ozi_alloc_fsdata(); + ozi_fsdata* fsdata = ozi_alloc_fsdata(); wpt_tmp = waypt_new(); /* data delimited by commas, possibly enclosed in quotes. */ @@ -817,8 +817,8 @@ data_read(void) switch (ozi_objective) { case trkdata: if (linecount > 6) {/* skipping over file header */ - ozi_convert_datum(wpt_tmp); - track_add_wpt(trk_head, wpt_tmp); + ozi_convert_datum(wpt_tmp); + track_add_wpt(trk_head, wpt_tmp); } else { waypt_free(wpt_tmp); } @@ -840,7 +840,7 @@ data_read(void) if (linecount > 4) { /* skipping over file header */ ozi_fsdata_used = true; fs_chain_add(&(wpt_tmp->fs), - (format_specific_data *) fsdata); + (format_specific_data*) fsdata); ozi_convert_datum(wpt_tmp); waypt_add(wpt_tmp); } else { @@ -853,7 +853,7 @@ data_read(void) } if (!ozi_fsdata_used) { - fs_chain_destroy((format_specific_data *) fsdata); + fs_chain_destroy((format_specific_data*) fsdata); } } else { @@ -864,18 +864,18 @@ data_read(void) } static void -ozi_waypt_pr(const waypoint * wpt) +ozi_waypt_pr(const waypoint* wpt) { static int index = 0; double alt; char ozi_time[16]; - char *description; - char *shortname; + char* description; + char* shortname; int faked_fsdata = 0; - ozi_fsdata *fs = NULL; + ozi_fsdata* fs = NULL; int icon = 0; - fs = (ozi_fsdata *) fs_chain_find(wpt->fs, FS_OZI); + fs = (ozi_fsdata*) fs_chain_find(wpt->fs, FS_OZI); if (!fs) { fs = ozi_alloc_fsdata(); @@ -945,7 +945,7 @@ ozi_waypt_pr(const waypoint * wpt) static void data_write(void) { - static const char *ozi_wpt_header = + static const char* ozi_wpt_header = "OziExplorer Waypoint File Version 1.1\r\n" "WGS 84\r\n" "Reserved 2\r\n" diff --git a/gpsbabel/parse.cc b/gpsbabel/parse.cc index 2453f1323..0fec10105 100644 --- a/gpsbabel/parse.cc +++ b/gpsbabel/parse.cc @@ -41,9 +41,9 @@ */ int -parse_distance(const char *str, double *val, double scale, const char *module) +parse_distance(const char* str, double* val, double scale, const char* module) { - char *unit; + char* unit; if ((str == NULL) || (*str == '\0')) { return 0; @@ -97,9 +97,9 @@ parse_distance(const char *str, double *val, double scale, const char *module) * module: calling module, i.e. "garmin_txt" */ int -parse_speed(const char *str, double *val, const double scale, const char *module) +parse_speed(const char* str, double* val, const double scale, const char* module) { - char *unit; + char* unit; if ((str == NULL) || (*str == '\0')) { return 0; @@ -152,8 +152,8 @@ parse_speed(const char *str, double *val, const double scale, const char *module */ int -parse_coordinates(const char *str, int datum, const grid_type grid, - double *latitude, double *longitude, const char *module) +parse_coordinates(const char* str, int datum, const grid_type grid, + double* latitude, double* longitude, const char* module) { double lat, lon; unsigned char lathemi, lonhemi; @@ -164,7 +164,7 @@ parse_coordinates(const char *str, int datum, const grid_type grid, char utmc; int valid, result, ct; double lx, ly; - const char *format; + const char* format; valid = 1; diff --git a/gpsbabel/pcx.cc b/gpsbabel/pcx.cc index 7dbcaf319..297460548 100644 --- a/gpsbabel/pcx.cc +++ b/gpsbabel/pcx.cc @@ -26,11 +26,11 @@ #include "garmin_tables.h" #include "csv_util.h" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static short_handle mkshort_handle; static short_handle mkshort_handle2; /* for track and route names */ -static char *deficon = NULL; -static char *cartoexploreur; +static char* deficon = NULL; +static char* cartoexploreur; static int read_as_degrees; static int read_gpsu; static int route_ctr; @@ -56,7 +56,7 @@ arglist_t pcx_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); } @@ -68,7 +68,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -93,11 +93,11 @@ data_read(void) char date[10]; char time[9]; char month[4]; - waypoint *wpt_tmp; - char *buff; + waypoint* wpt_tmp; + char* buff; struct tm tm; - route_head *track = NULL; - route_head *route = NULL; + route_head* track = NULL; + route_head* route = NULL; int n; char lathemi, lonhemi; char tbuf[20]; @@ -109,8 +109,8 @@ data_read(void) points = 0; while ((buff = gbfgetstr(file_in))) { - char *ibuf = lrtrim(buff); - char *cp; + char* ibuf = lrtrim(buff); + char* cp; if ((line++ == 0) && file_in->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -288,7 +288,7 @@ data_read(void) // where our other columns start. case 'F': { int col; - char *i = ibuf; + char* i = ibuf; sym_col = 0; for (col = 0, i = ibuf; *i; col++, i++) { @@ -316,7 +316,7 @@ data_read(void) } static void -gpsutil_disp(const waypoint *wpt) +gpsutil_disp(const waypoint* wpt) { double lon,lat; int icon_token = 0; @@ -358,9 +358,9 @@ gpsutil_disp(const waypoint *wpt) } static void -pcx_track_hdr(const route_head *trk) +pcx_track_hdr(const route_head* trk) { - char *name; + char* name; char buff[20]; route_ctr++; @@ -378,9 +378,9 @@ pcx_track_hdr(const route_head *trk) } static void -pcx_route_hdr(const route_head *rte) +pcx_route_hdr(const route_head* rte) { - char *name; + char* name; char buff[20]; route_ctr++; @@ -397,12 +397,12 @@ pcx_route_hdr(const route_head *rte) } void -pcx_track_disp(const waypoint *wpt) +pcx_track_disp(const waypoint* wpt) { double lon,lat; char tbuf[100]; - struct tm *tm; - char *tp; + struct tm* tm; + char* tp; lon = degrees2ddmm(wpt->longitude); lat = degrees2ddmm(wpt->latitude); diff --git a/gpsbabel/pocketfms_bc.cc b/gpsbabel/pocketfms_bc.cc index c43b32d11..9d9ada54d 100644 --- a/gpsbabel/pocketfms_bc.cc +++ b/gpsbabel/pocketfms_bc.cc @@ -51,10 +51,10 @@ typedef struct breadcrumb { uint16_t reserve2; // 0x0000 } BREADCRUMB; -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -66,7 +66,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); } @@ -81,7 +81,7 @@ static void read_tracks(void) { struct breadcrumb bc; - route_head *trk_head = route_head_alloc(); + route_head* trk_head = route_head_alloc(); trk_head->rte_num = 1; trk_head->rte_name = xstrdup("PocketFMS"); trk_head->rte_desc = xstrdup("Breadcrumb"); @@ -90,7 +90,7 @@ read_tracks(void) while (1 == gbfread(&bc, sizeof(bc), 1, file_in)) { struct tm tm; - waypoint *wpt; + waypoint* wpt; if (strcmp(bc.id, header_id) != 0) { fatal(MYNAME ": invalid breadcrumb header in input file.\n"); @@ -114,22 +114,22 @@ read_tracks(void) wpt->pdop = le_read_float(&bc.espe); wpt->course = le_read_float(&bc.course); wpt->speed = le_read_float(&bc.speed); - wpt->fix = (fix_type) (le_readu16(&bc.fix) - 1); + wpt->fix = (fix_type)(le_readu16(&bc.fix) - 1); track_add_wpt(trk_head, wpt); } } static void -route_head_noop(const route_head *wp) +route_head_noop(const route_head* wp) { } static void -pocketfms_waypt_disp(const waypoint *wpt) +pocketfms_waypt_disp(const waypoint* wpt) { struct breadcrumb bc; - struct tm *tm; + struct tm* tm; memset(&bc, 0, sizeof(bc)); const time_t tt = wpt->GetCreationTime().toTime_t(); diff --git a/gpsbabel/pocketfms_fp.cc b/gpsbabel/pocketfms_fp.cc index c11c286ab..814a5da72 100644 --- a/gpsbabel/pocketfms_fp.cc +++ b/gpsbabel/pocketfms_fp.cc @@ -25,8 +25,8 @@ #include "xmlgeneric.h" static int isFirst = 1; -static route_head *route = NULL; -static waypoint *wpt_to, *wpt_from; +static route_head* route = NULL; +static waypoint* wpt_to, *wpt_from; static double dest_altitude; #define MYNAME "PocketFMS FlightPlan" @@ -50,7 +50,7 @@ static xg_tag_mapping gl_map[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { xml_init(fname, gl_map, NULL); } @@ -65,8 +65,8 @@ static void rd_deinit(void) { if (route != NULL) { - waypoint *head = (waypoint *) QUEUE_FIRST(&route->waypoint_list); - waypoint *tail = (waypoint *) QUEUE_LAST(&route->waypoint_list); + waypoint* head = (waypoint*) QUEUE_FIRST(&route->waypoint_list); + waypoint* tail = (waypoint*) QUEUE_LAST(&route->waypoint_list); if (head != NULL) { route->rte_name = xstrdup(head->shortname); } @@ -80,12 +80,12 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { fatal("Writing file of type %s is not supported\n", MYNAME); } -void wpt_s(const char *args, const QXmlStreamAttributes* unused) +void wpt_s(const char* args, const QXmlStreamAttributes* unused) { if (isFirst == 1) { wpt_from = waypt_new(); @@ -96,7 +96,7 @@ void wpt_s(const char *args, const QXmlStreamAttributes* unused) wpt_to = waypt_new(); } -void wpt_e(const char *args, const QXmlStreamAttributes* unused) +void wpt_e(const char* args, const QXmlStreamAttributes* unused) { if (isFirst == 1) { route_add_wpt(route, wpt_from); @@ -113,55 +113,55 @@ void wpt_e(const char *args, const QXmlStreamAttributes* unused) wpt_to = NULL; } -void wpt_from_lat(const char *args, const QXmlStreamAttributes* unused) +void wpt_from_lat(const char* args, const QXmlStreamAttributes* unused) { if (wpt_from != NULL) { wpt_from->latitude = atof(args); } } -void wpt_from_lon(const char *args, const QXmlStreamAttributes* unused) +void wpt_from_lon(const char* args, const QXmlStreamAttributes* unused) { if (wpt_from != NULL) { wpt_from->longitude = atof(args); } } -void wpt_from_name(const char *args, const QXmlStreamAttributes* unused) +void wpt_from_name(const char* args, const QXmlStreamAttributes* unused) { if (wpt_from != NULL) { wpt_from->shortname = xstrappend(wpt_from->shortname, args); } } -void wpt_from_elev(const char *args, const QXmlStreamAttributes* unused) +void wpt_from_elev(const char* args, const QXmlStreamAttributes* unused) { if (wpt_from != NULL) { wpt_from->altitude = FEET_TO_METERS(atof(args)); } } -void wpt_to_lat(const char *args, const QXmlStreamAttributes* unused) +void wpt_to_lat(const char* args, const QXmlStreamAttributes* unused) { wpt_to->latitude = atof(args); } -void wpt_to_lon(const char *args, const QXmlStreamAttributes* unused) +void wpt_to_lon(const char* args, const QXmlStreamAttributes* unused) { wpt_to->longitude = atof(args); } -void wpt_to_name(const char *args, const QXmlStreamAttributes* unused) +void wpt_to_name(const char* args, const QXmlStreamAttributes* unused) { wpt_to->shortname = xstrappend(wpt_to->shortname, args); } -void wpt_to_elev(const char *args, const QXmlStreamAttributes* unused) +void wpt_to_elev(const char* args, const QXmlStreamAttributes* unused) { dest_altitude = FEET_TO_METERS(atof(args)); } -void wpt_altitude(const char *args, const QXmlStreamAttributes* attrv) +void wpt_altitude(const char* args, const QXmlStreamAttributes* attrv) { int isFeet = 0; diff --git a/gpsbabel/pocketfms_wp.cc b/gpsbabel/pocketfms_wp.cc index 7e9ce1eec..b4ff60433 100644 --- a/gpsbabel/pocketfms_wp.cc +++ b/gpsbabel/pocketfms_wp.cc @@ -23,15 +23,15 @@ #define MYNAME "PocketFMS waypoint text file format" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "r", MYNAME); } -double wppos_to_dec(char *value) +double wppos_to_dec(char* value) { if (strstr(value, "\xB0") == NULL) { return atof(value); @@ -55,11 +55,11 @@ double wppos_to_dec(char *value) static void data_read(void) { - char *buff; + char* buff; int linecount = 0; while ((buff = gbfgetstr(file_in))) { - char *s; - waypoint *wpt; + char* s; + waypoint* wpt; rtrim(buff); if (strlen(buff) == 0) { break; @@ -94,23 +94,23 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "w", MYNAME); } static void -enigma_waypt_disp(const waypoint *wpt) +enigma_waypt_disp(const waypoint* wpt) { - char *t; + char* t; if (wpt->shortname) { // The output might have a space or control character. int i, l = strlen(wpt->shortname); t = (char*) xmalloc(l + 1); - char *d = t; + char* d = t; for (i = 0; i < l; i++) { char s = wpt->shortname[i]; - if(isgraph(s)) { + if (isgraph(s)) { *d++ = s; } } diff --git a/gpsbabel/polygon.cc b/gpsbabel/polygon.cc index 700f2257c..b6a334a53 100644 --- a/gpsbabel/polygon.cc +++ b/gpsbabel/polygon.cc @@ -24,8 +24,8 @@ #if FILTERS_ENABLED #define MYNAME "Polygon filter" -static char *polyfileopt = NULL; -static char *exclopt = NULL; +static char* polyfileopt = NULL; +static char* exclopt = NULL; /* * This test for insideness is essentially an odd/even test. The @@ -123,7 +123,7 @@ arglist_t polygon_args[] = { static void polytest(double lat1, double lon1, double lat2, double lon2, double wlat, double wlon, - unsigned short *state, int first, int last) + unsigned short* state, int first, int last) { if (lat1 == wlat) { @@ -235,22 +235,22 @@ static void polytest(double lat1, double lon1, void polygon_process(void) { - queue * elem, * tmp; - waypoint * waypointp; - extra_data *ed; + queue* elem, * tmp; + waypoint* waypointp; + extra_data* ed; double lat1, lon1, lat2, lon2; double olat, olon; int fileline = 0; int first = 1; int last = 0; - char *line; - gbfile *file_in; + char* line; + gbfile* file_in; file_in = gbfopen(polyfileopt, "r", MYNAME); olat = olon = lat1 = lon1 = lat2 = lon2 = BADVAL; while ((line = gbfgetstr(file_in))) { - char *pound = NULL; + char* pound = NULL; int argsfound = 0; fileline++; @@ -273,15 +273,15 @@ polygon_process(void) foreach(waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *)elem; + waypointp = (waypoint*)elem; #endif if (waypointp->extra_data) { - ed = (extra_data *) waypointp->extra_data; + ed = (extra_data*) waypointp->extra_data; } else { - ed = (extra_data *) xcalloc(1, sizeof(*ed)); + ed = (extra_data*) xcalloc(1, sizeof(*ed)); ed->state = OUTSIDE; ed->override = 0; - waypointp->extra_data = (extra_data *) ed; + waypointp->extra_data = (extra_data*) ed; } if (lat2 == waypointp->latitude && lon2 == waypointp->longitude) { @@ -322,9 +322,9 @@ polygon_process(void) foreach(waypoint* wp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypoint *wp = (waypoint *) elem; + waypoint* wp = (waypoint*) elem; #endif - ed = (extra_data *) wp->extra_data; + ed = (extra_data*) wp->extra_data; wp->extra_data = NULL; if (ed) { if (ed->override) { @@ -340,7 +340,7 @@ polygon_process(void) } void -polygon_init(const char *args) +polygon_init(const char* args) { /* do nothing */ } diff --git a/gpsbabel/position.cc b/gpsbabel/position.cc index 95793dde4..51267b8ce 100644 --- a/gpsbabel/position.cc +++ b/gpsbabel/position.cc @@ -30,13 +30,13 @@ # define M_PI 3.14159265358979323846 #endif -static route_head *cur_rte = NULL; +static route_head* cur_rte = NULL; static double pos_dist; static double max_diff_time; -static char *distopt = NULL; -static char *timeopt = NULL; -static char *purge_duplicates = NULL; +static char* distopt = NULL; +static char* timeopt = NULL; +static char* purge_duplicates = NULL; static int check_time; typedef struct { @@ -74,19 +74,19 @@ gc_distance(double lat1, double lon1, double lat2, double lon2) /* tear through a waypoint queue, processing points by distance */ static void -position_runqueue(queue *q, int nelems, int qtype) +position_runqueue(queue* q, int nelems, int qtype) { - queue * elem, * tmp; - waypoint ** comp; - int * qlist; + queue* elem, * tmp; + waypoint** comp; + int* qlist; double dist, diff_time; int i = 0, j, anyitem; - comp = (waypoint **) xcalloc(nelems, sizeof(*comp)); - qlist = (int *) xcalloc(nelems, sizeof(*qlist)); + comp = (waypoint**) xcalloc(nelems, sizeof(*comp)); + qlist = (int*) xcalloc(nelems, sizeof(*qlist)); QUEUE_FOR_EACH(q, elem, tmp) { - comp[i] = (waypoint *)elem; + comp[i] = (waypoint*)elem; qlist[i] = 0; i++; } @@ -160,25 +160,25 @@ position_runqueue(queue *q, int nelems, int qtype) } static void -position_process_route(const route_head * rh) +position_process_route(const route_head* rh) { int i = rh->rte_waypt_ct; if (i) { - cur_rte = (route_head *)rh; - position_runqueue((queue *)&rh->waypoint_list, i, rtedata); + cur_rte = (route_head*)rh; + position_runqueue((queue*)&rh->waypoint_list, i, rtedata); cur_rte = NULL; } } static void -position_noop_w(const waypoint *w) +position_noop_w(const waypoint* w) { } static void -position_noop_t(const route_head *h) +position_noop_t(const route_head* h) { } @@ -195,9 +195,9 @@ void position_process(void) } void -position_init(const char *args) +position_init(const char* args) { - char *fm; + char* fm; pos_dist = 0; max_diff_time = 0; diff --git a/gpsbabel/psitrex.cc b/gpsbabel/psitrex.cc index 4eaff9312..261947506 100644 --- a/gpsbabel/psitrex.cc +++ b/gpsbabel/psitrex.cc @@ -38,11 +38,11 @@ typedef enum { typedef struct psit_icon_mapping { const int value; - const char *icon; + const char* icon; } psit_icon_mapping_t; -static gbfile *psit_file_in; -static gbfile *psit_file_out; +static gbfile* psit_file_in; +static gbfile* psit_file_out; static short_handle mkshort_handle; /* 2 = not written any tracks out @@ -52,7 +52,7 @@ static int psit_track_state = 2; static char psit_current_token[256]; -char *snlen; +char* snlen; static arglist_t psit_args[] = { @@ -145,10 +145,10 @@ const psit_icon_mapping_t psit_icon_value_table[] = { { -1, NULL } }; -static const char * +static const char* psit_find_desc_from_icon_number(const int icon) { - const psit_icon_mapping_t *i; + const psit_icon_mapping_t* i; for (i = psit_icon_value_table; i->icon; i++) { if (icon == i->value) { @@ -159,9 +159,9 @@ psit_find_desc_from_icon_number(const int icon) } static int -psit_find_icon_number_from_desc(const char *desc) +psit_find_icon_number_from_desc(const char* desc) { - const psit_icon_mapping_t *i; + const psit_icon_mapping_t* i; int def_icon = 18; if (!desc) { @@ -180,7 +180,7 @@ psit_find_icon_number_from_desc(const char *desc) } static void -psit_rd_init(const char *fname) +psit_rd_init(const char* fname) { psit_file_in = gbfopen(fname, "r", MYNAME); } @@ -192,7 +192,7 @@ psit_rd_deinit(void) } static void -psit_wr_init(const char *fname) +psit_wr_init(const char* fname) { psit_file_out = gbfopen(fname, "w", MYNAME); } @@ -208,7 +208,7 @@ psit_wr_deinit(void) * and write into buf. */ static void -psit_getToken(gbfile *psit_file, char *buf, size_t sz, psit_tokenSep_type delimType) +psit_getToken(gbfile* psit_file, char* buf, size_t sz, psit_tokenSep_type delimType) { int c = -1; @@ -272,7 +272,7 @@ psit_getToken(gbfile *psit_file, char *buf, size_t sz, psit_tokenSep_type delimT * */ static int -psit_isKnownToken(char *buf) +psit_isKnownToken(char* buf) { if (strcmp(buf, "Track:") == 0) { return 0; @@ -294,11 +294,11 @@ psit_isKnownToken(char *buf) * MRCB */ static void -psit_waypoint_r(gbfile *psit_file, waypoint **wpt) +psit_waypoint_r(gbfile* psit_file, waypoint** wpt) { int garmin_icon_num; - waypoint *thisWaypoint; + waypoint* thisWaypoint; if (strlen(psit_current_token) > 0) { thisWaypoint = waypt_new(); @@ -339,11 +339,11 @@ psit_waypoint_r(gbfile *psit_file, waypoint **wpt) * MRCB */ static void -psit_waypoint_w(gbfile *psit_file, const waypoint *wpt) +psit_waypoint_w(gbfile* psit_file, const waypoint* wpt) { int icon; - const char *ident; - char *src = 0; /* BUGBUG Passed to mkshort */ + const char* ident; + char* src = 0; /* BUGBUG Passed to mkshort */ gbfprintf(psit_file, "%11.6f,%11.6f,", wpt->latitude, @@ -376,7 +376,7 @@ psit_waypoint_w(gbfile *psit_file, const waypoint *wpt) } static void -psit_waypoint_w_wrapper(const waypoint *wpt) +psit_waypoint_w_wrapper(const waypoint* wpt) { psit_waypoint_w(psit_file_out, wpt); } @@ -386,17 +386,17 @@ psit_waypoint_w_wrapper(const waypoint *wpt) * MRCB */ static void -psit_route_r(gbfile *psit_file, route_head **rte) +psit_route_r(gbfile* psit_file, route_head** rte) { char rtename[256]; unsigned int rte_num; int garmin_icon_num; - route_head *rte_head; + route_head* rte_head; unsigned int rte_count; - waypoint *thisWaypoint; + waypoint* thisWaypoint; psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), ltrimEOL); @@ -466,27 +466,27 @@ psit_route_r(gbfile *psit_file, route_head **rte) * MRCB */ static void -psit_routehdr_w(gbfile *psit_file, const route_head *rte) +psit_routehdr_w(gbfile* psit_file, const route_head* rte) { char hdr[20]; unsigned int rte_datapoints; - char *rname; + char* rname; - waypoint *testwpt; + waypoint* testwpt; time_t uniqueValue = 0; int allWptNameLengths; - queue *elem, *tmp; + queue* elem, *tmp; /* total nodes (waypoints) this route */ rte_datapoints = 0; allWptNameLengths = 0; if (rte->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid route - treat as a placeholder for now */ - char *c; + char* c; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - testwpt = (waypoint *)elem; + testwpt = (waypoint*)elem; if (rte_datapoints == 0) { uniqueValue = testwpt->GetCreationTime().toTime_t(); } @@ -515,7 +515,7 @@ psit_routehdr_w(gbfile *psit_file, const route_head *rte) } static void -psit_routehdr_w_wrapper(const route_head *rte) +psit_routehdr_w_wrapper(const route_head* rte) { psit_routehdr_w(psit_file_out, rte); } @@ -526,7 +526,7 @@ psit_routehdr_w_wrapper(const route_head *rte) * MRCB */ static void -psit_track_r(gbfile *psit_file, route_head **trk) +psit_track_r(gbfile* psit_file, route_head** trk) { char tbuf[100]; char trkname[256]; @@ -534,10 +534,10 @@ psit_track_r(gbfile *psit_file, route_head **trk) struct tm tmTime; time_t dateTime = 0; - route_head *track_head = NULL; + route_head* track_head = NULL; unsigned int trk_count; - waypoint *thisWaypoint; + waypoint* thisWaypoint; psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), ltrimEOL); if (strlen(psit_current_token) == 0) { @@ -629,25 +629,25 @@ psit_track_r(gbfile *psit_file, route_head **trk) * MRCB */ static void -psit_trackhdr_w(gbfile *psit_file, const route_head *trk) +psit_trackhdr_w(gbfile* psit_file, const route_head* trk) { char hdr[30]; unsigned int trk_datapoints; - char *tname; - waypoint *testwpt; + char* tname; + waypoint* testwpt; time_t uniqueValue = 0; - queue *elem, *tmp; + queue* elem, *tmp; if (psit_track_state == 2) { /* total nodes (waypoints) this track */ trk_datapoints = 0; if (trk->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid track - treat as a placeholder for now */ - char *c; + char* c; QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) { if (trk_datapoints == 0) { - testwpt = (waypoint *)elem; + testwpt = (waypoint*)elem; uniqueValue = testwpt->GetCreationTime().toTime_t(); } trk_datapoints++; @@ -679,7 +679,7 @@ psit_trackhdr_w(gbfile *psit_file, const route_head *trk) } static void -psit_trackhdr_w_wrapper(const route_head *trk) +psit_trackhdr_w_wrapper(const route_head* trk) { psit_trackhdr_w(psit_file_out, trk); } @@ -690,10 +690,10 @@ psit_trackhdr_w_wrapper(const route_head *trk) * MRCB */ static void -psit_trackdatapoint_w(gbfile *psit_file, const waypoint *wpt) +psit_trackdatapoint_w(gbfile* psit_file, const waypoint* wpt) { time_t t = wpt->GetCreationTime().toTime_t(); - struct tm *tmTime = gmtime(&t); + struct tm* tmTime = gmtime(&t); gbfprintf(psit_file, "%11.6f,%11.6f,", wpt->latitude, @@ -719,7 +719,7 @@ psit_trackdatapoint_w(gbfile *psit_file, const waypoint *wpt) } static void -psit_trackdatapoint_w_wrapper(const waypoint *wpt) +psit_trackdatapoint_w_wrapper(const waypoint* wpt) { psit_trackdatapoint_w(psit_file_out, wpt); } @@ -728,9 +728,9 @@ psit_trackdatapoint_w_wrapper(const waypoint *wpt) static void psit_read(void) { - waypoint *wpt; - route_head *rte; - route_head *trk; + waypoint* wpt; + route_head* rte; + route_head* trk; #ifdef DUMP_ICON_TABLE printf("static icon_mapping_t icon_table[] = {\n"); @@ -779,7 +779,7 @@ psit_read(void) } static void -psit_noop(const route_head *wp) +psit_noop(const route_head* wp) { /* no-op */ } diff --git a/gpsbabel/queue.cc b/gpsbabel/queue.cc index 3bd0c082c..76ccee647 100644 --- a/gpsbabel/queue.cc +++ b/gpsbabel/queue.cc @@ -23,7 +23,7 @@ #include "stddef.h" void -enqueue(queue *new_el, queue *old) +enqueue(queue* new_el, queue* old) { new_el->next = old->next; new_el->prev = old; @@ -31,11 +31,11 @@ enqueue(queue *new_el, queue *old) old->next = new_el; } -queue * -dequeue(queue *element) +queue* +dequeue(queue* element) { - queue *prev = element->prev; - queue *next = element->next; + queue* prev = element->prev; + queue* next = element->next; next->prev = prev; prev->next = next; @@ -90,10 +90,10 @@ dequeue(queue *element) void -sortqueue(queue *qh, int (*cmp)(const queue *, const queue *)) +sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) { - queue *p, *q, *e, *tail, *oldhead, *list; + queue* p, *q, *e, *tail, *oldhead, *list; int insize, nmerges, psize, qsize, i; /* diff --git a/gpsbabel/radius.cc b/gpsbabel/radius.cc index 941edc92d..10cc2b8c9 100644 --- a/gpsbabel/radius.cc +++ b/gpsbabel/radius.cc @@ -29,16 +29,16 @@ #endif static double pos_dist; -static char *distopt = NULL; -static char *latopt = NULL; -static char *lonopt = NULL; -static char *exclopt = NULL; -static char *nosort = NULL; -static char *maxctarg = NULL; -static char *routename = NULL; +static char* distopt = NULL; +static char* latopt = NULL; +static char* lonopt = NULL; +static char* exclopt = NULL; +static char* nosort = NULL; +static char* maxctarg = NULL; +static char* routename = NULL; static int maxct; -static waypoint * home_pos; +static waypoint* home_pos; typedef struct { double distance; @@ -89,12 +89,12 @@ gc_distance(double lat1, double lon1, double lat2, double lon2) } static int -dist_comp(const void * a, const void * b) +dist_comp(const void* a, const void* b) { - const waypoint *x1 = *(waypoint **)a; - const waypoint *x2 = *(waypoint **)b; - extra_data *x1e = (extra_data *) x1->extra_data; - extra_data *x2e = (extra_data *) x2->extra_data; + const waypoint* x1 = *(waypoint**)a; + const waypoint* x2 = *(waypoint**)b; + extra_data* x1e = (extra_data*) x1->extra_data; + extra_data* x2e = (extra_data*) x2->extra_data; if (x1e->distance > x2e->distance) { return 1; @@ -109,18 +109,18 @@ dist_comp(const void * a, const void * b) void radius_process(void) { - queue * elem, * tmp; - waypoint * waypointp; + queue* elem, * tmp; + waypoint* waypointp; double dist; - waypoint ** comp; + waypoint** comp; int i, wc; queue temp_head; - route_head *rte_head = NULL; + route_head* rte_head = NULL; #if NEWQ foreach(waypoint* waypointp, waypt_list) { #else QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *)elem; + waypointp = (waypoint*)elem; #endif dist = gc_distance(waypointp->latitude, waypointp->longitude, @@ -136,7 +136,7 @@ radius_process(void) continue; } - extra_data *ed = (extra_data *) xcalloc(1, sizeof(*ed)); + extra_data* ed = (extra_data*) xcalloc(1, sizeof(*ed)); ed->distance = dist; waypointp->extra_data = ed; } @@ -144,7 +144,7 @@ radius_process(void) wc = waypt_count(); QUEUE_INIT(&temp_head); - comp = (waypoint **) xcalloc(wc, sizeof(*comp)); + comp = (waypoint**) xcalloc(wc, sizeof(*comp)); i = 0; @@ -155,14 +155,14 @@ radius_process(void) */ QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypoint *wp = (waypoint *) elem; + waypoint* wp = (waypoint*) elem; comp[i] = wp; waypt_del(wp); i++; } if (!nosort) { - qsort(comp, wc, sizeof(waypoint *), dist_comp); + qsort(comp, wc, sizeof(waypoint*), dist_comp); } if (routename) { @@ -177,7 +177,7 @@ radius_process(void) * on through in the modified order. */ for (i = 0; i < wc; i++) { - waypoint * wp = comp[i]; + waypoint* wp = comp[i]; xfree(wp->extra_data); wp->extra_data = NULL; @@ -196,9 +196,9 @@ radius_process(void) } void -radius_init(const char *args) +radius_init(const char* args) { - char *fm; + char* fm; pos_dist = 0; @@ -217,7 +217,7 @@ radius_init(const char *args) maxct = 0; } - home_pos = (waypoint *) xcalloc(sizeof(*home_pos), 1); + home_pos = (waypoint*) xcalloc(sizeof(*home_pos), 1); if (latopt) { home_pos->latitude = atof(latopt); diff --git a/gpsbabel/random.cc b/gpsbabel/random.cc index 61523057a..cb190a973 100644 --- a/gpsbabel/random.cc +++ b/gpsbabel/random.cc @@ -25,7 +25,7 @@ #define MYNAME "random" -static char *opt_points, *opt_seed; +static char* opt_points, *opt_seed; static arglist_t random_args[] = { { @@ -54,10 +54,10 @@ rand_int(const int max) /* rand_str always returns a valid string with len >= 0 */ -static char * -rand_str(const int maxlen, const char *fmt) +static char* +rand_str(const int maxlen, const char* fmt) { - char *res; + char* res; int i, len; len = rand_int(maxlen) + 1; @@ -77,7 +77,7 @@ rand_str(const int maxlen, const char *fmt) res[i] = c; } if (fmt) { - char *tmp; + char* tmp; xasprintf(&tmp, fmt, res); xfree(res); return tmp; @@ -87,7 +87,7 @@ rand_str(const int maxlen, const char *fmt) } static void -random_rd_init(const char *fname) +random_rd_init(const char* fname) { } @@ -102,8 +102,8 @@ random_read(void) #define RND(a) (rand_int(a) > 0) int i, points; - route_head *head; - waypoint *prev = NULL; + route_head* head; + waypoint* prev = NULL; time_t time = gpsbabel_time; if (opt_seed) { @@ -130,12 +130,12 @@ random_read(void) for (i = 0; i < points; i++) { - waypoint *wpt; - garmin_fs_t *gmsd; + waypoint* wpt; + garmin_fs_t* gmsd; wpt = waypt_new(); gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); do { wpt->shortname = rand_str(8, "Wpt_%s"); diff --git a/gpsbabel/raymarine.cc b/gpsbabel/raymarine.cc index d0e3186b7..6575f5eda 100644 --- a/gpsbabel/raymarine.cc +++ b/gpsbabel/raymarine.cc @@ -53,13 +53,13 @@ typedef unsigned long long guid_t; -static inifile_t *fin; -static gbfile *fout; -static waypoint **waypt_table; +static inifile_t* fin; +static gbfile* fout; +static waypoint** waypt_table; static short_handle hshort_wpt, hshort_rte; static int waypt_table_sz, waypt_table_ct; static int rte_index, rte_wpt_index; -static char *opt_location; +static char* opt_location; #define MYNAME "raymarine" @@ -79,8 +79,8 @@ arglist_t raymarine_args[] = { /* Bitmaps */ typedef struct { - const char *name; - const char *mps_name; + const char* name; + const char* mps_name; } raymarine_symbol_mapping_t; static raymarine_symbol_mapping_t raymarine_symbols[] = { @@ -144,7 +144,7 @@ find_symbol_num(const QString& descr) { if (!descr.isNull()) { - raymarine_symbol_mapping_t *a; + raymarine_symbol_mapping_t* a; a = &raymarine_symbols[0]; @@ -166,7 +166,7 @@ find_symbol_num(const QString& descr) /* ============================================= */ static void -raymarine_rd_init(const char *fname) +raymarine_rd_init(const char* fname) { fin = inifile_init(fname, MYNAME); if (fin->unicode) { @@ -183,7 +183,7 @@ raymarine_rd_done(void) static void raymarine_read(void) { - waypoint *wpt; + waypoint* wpt; unsigned int ix; unsigned int rx; @@ -191,7 +191,7 @@ raymarine_read(void) for (ix = 0; ix < 0x3FFF; ix++) { char sect[10]; - char *str, *name, *lat, *lon; + char* str, *name, *lat, *lon; /* built section identifier */ snprintf(sect, sizeof(sect), "Wp%d", ix); @@ -234,8 +234,8 @@ raymarine_read(void) for (rx = 0; rx < 0x3FFF; rx++) { char sect[10]; - char *name; - route_head *rte; + char* name; + route_head* rte; int wx; snprintf(sect, sizeof(sect), "Rt%d", rx); @@ -249,8 +249,8 @@ raymarine_read(void) for (wx = 0; wx < 0x3FFF; wx++) { char buff[32]; - char *str; - waypoint * wpt; + char* str; + waypoint* wpt; snprintf(buff, sizeof(buff), "Mk%d", wx); str = inifile_readstr(fin, sect, buff); @@ -275,7 +275,7 @@ raymarine_read(void) /* make waypoint shortnames unique */ static char -same_points(const waypoint *A, const waypoint *B) +same_points(const waypoint* A, const waypoint* B) { return ( /* !!! We are case-sensitive !!! */ (strcmp(A->shortname, B->shortname) == 0) && @@ -284,13 +284,13 @@ same_points(const waypoint *A, const waypoint *B) } static void -register_waypt(const waypoint *ref, const char is_rtept) +register_waypt(const waypoint* ref, const char is_rtept) { int i; - waypoint *wpt = (waypoint *) ref; + waypoint* wpt = (waypoint*) ref; for (i = 0; i < waypt_table_ct; i++) { - waypoint *cmp = waypt_table[i]; + waypoint* cmp = waypt_table[i]; if (same_points(wpt, cmp)) { wpt->extra_data = cmp->extra_data; @@ -307,38 +307,38 @@ register_waypt(const waypoint *ref, const char is_rtept) } } - wpt->extra_data = (void *)mkshort(hshort_wpt, wpt->shortname); + wpt->extra_data = (void*)mkshort(hshort_wpt, wpt->shortname); - waypt_table[waypt_table_ct] = (waypoint *)wpt; + waypt_table[waypt_table_ct] = (waypoint*)wpt; waypt_table_ct++; } static void -enum_waypt_cb(const waypoint *wpt) +enum_waypt_cb(const waypoint* wpt) { - register_waypt((waypoint *) wpt, 0); + register_waypt((waypoint*) wpt, 0); } static void -enum_rtept_cb(const waypoint *wpt) +enum_rtept_cb(const waypoint* wpt) { - register_waypt((waypoint *) wpt, 1); + register_waypt((waypoint*) wpt, 1); } static int -qsort_cb(const void *a, const void *b) +qsort_cb(const void* a, const void* b) { - const waypoint *wa = *(waypoint **)a; - const waypoint *wb = *(waypoint **)b; + const waypoint* wa = *(waypoint**)a; + const waypoint* wb = *(waypoint**)b; return strcmp(wa->shortname, wb->shortname); } static void -write_waypoint(gbfile *fout, const waypoint *wpt, const int waypt_no, const char *location) +write_waypoint(gbfile* fout, const waypoint* wpt, const int waypt_no, const char* location) { - const char *notes; - char *name; + const char* notes; + char* name; double time; notes = wpt->notes; @@ -350,7 +350,7 @@ write_waypoint(gbfile *fout, const waypoint *wpt, const int waypt_no, const char } notes = csv_stringclean(notes, LINE_FEED); time = wpt->creation_time.isValid() ? TIMET_TO_EXCEL(wpt->GetCreationTime().toTime_t()) : TIMET_TO_EXCEL(gpsbabel_time); - name = (char *)wpt->extra_data; + name = (char*)wpt->extra_data; gbfprintf(fout, "[Wp%d]" LINE_FEED "Loc=%s" LINE_FEED @@ -384,10 +384,10 @@ write_waypoint(gbfile *fout, const waypoint *wpt, const int waypt_no, const char } static void -write_route_head_cb(const route_head *rte) +write_route_head_cb(const route_head* rte) { char buff[32]; - char *name; + char* name; name = rte->rte_name; if ((name == NULL) || (*name == '\0')) { @@ -408,9 +408,9 @@ write_route_head_cb(const route_head *rte) } static void -write_route_wpt_cb(const waypoint *wpt) +write_route_wpt_cb(const waypoint* wpt) { - static const char *items[] = { + static const char* items[] = { "Cog", "Eta", "Length", @@ -423,8 +423,8 @@ write_route_wpt_cb(const waypoint *wpt) "PredictedTws" }; - gbfprintf(fout, "Mk%d=%s" LINE_FEED, rte_wpt_index, (char *)wpt->extra_data); - for (unsigned i = 0; i < sizeof(items) / sizeof(char *); i++) { + gbfprintf(fout, "Mk%d=%s" LINE_FEED, rte_wpt_index, (char*)wpt->extra_data); + for (unsigned i = 0; i < sizeof(items) / sizeof(char*); i++) { gbfprintf(fout, "%s%d=%.15f" LINE_FEED, items[i], rte_wpt_index, 0.0); } @@ -433,7 +433,7 @@ write_route_wpt_cb(const waypoint *wpt) } static void -enum_route_hdr_cb(const route_head *rte) +enum_route_hdr_cb(const route_head* rte) { is_fatal(rte->rte_waypt_ct > 50, MYNAME ": Routes with more than 50 points are not supported by Waymarine!"); @@ -457,7 +457,7 @@ raymarine_new_short_handle(void) } static void -raymarine_wr_init(const char *fname) +raymarine_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); @@ -478,7 +478,7 @@ static void raymarine_write(void) { int i; - waypoint *wpt; + waypoint* wpt; waypt_table_sz = 0; waypt_table_ct = 0; @@ -496,7 +496,7 @@ raymarine_write(void) /* write out waypoint summary */ for (i = 0; i < waypt_table_ct; i++) { - waypoint *wpt = waypt_table[i]; + waypoint* wpt = waypt_table[i]; write_waypoint(fout, wpt, i, opt_location); } diff --git a/gpsbabel/reverse_route.cc b/gpsbabel/reverse_route.cc index 0addc1120..be466cd38 100644 --- a/gpsbabel/reverse_route.cc +++ b/gpsbabel/reverse_route.cc @@ -38,18 +38,18 @@ arglist_t reverse_route_args[] = { static void reverse_route_wpt(const waypoint* waypointp) { - /* Cast away const-ness */ - waypoint* wpp = (waypoint *) waypointp; + /* Cast away const-ness */ + waypoint* wpp = (waypoint*) waypointp; - int curr_new_trkseg; + int curr_new_trkseg; - curr_new_trkseg = waypointp->wpt_flags.new_trkseg; - wpp->wpt_flags.new_trkseg = prev_new_trkseg; - prev_new_trkseg = curr_new_trkseg; + curr_new_trkseg = waypointp->wpt_flags.new_trkseg; + wpp->wpt_flags.new_trkseg = prev_new_trkseg; + prev_new_trkseg = curr_new_trkseg; } void -reverse_route_head(const route_head *rte) +reverse_route_head(const route_head* rte) { route_reverse(rte); prev_new_trkseg = 1; @@ -63,7 +63,7 @@ reverse_route_process(void) } void -reverse_route_init(const char *args) +reverse_route_init(const char* args) { switch (global_opts.objective) { case rtedata: diff --git a/gpsbabel/rgbcolors.cc b/gpsbabel/rgbcolors.cc index 4ad45e67d..aca6958e5 100644 --- a/gpsbabel/rgbcolors.cc +++ b/gpsbabel/rgbcolors.cc @@ -28,7 +28,7 @@ */ static const struct { - const char *cn; + const char* cn; unsigned char r; unsigned char g; unsigned char b; @@ -189,9 +189,9 @@ static const struct { */ static int HexDigit(char hex) { - const char *Digits = "0123456789ABCDEF"; - const char *digits = "0123456789abcdef"; - const char *ofs = strchr(digits, hex); + const char* Digits = "0123456789ABCDEF"; + const char* digits = "0123456789abcdef"; + const char* ofs = strchr(digits, hex); if (ofs) { return ofs-digits; } @@ -218,11 +218,11 @@ static int HexByte(const char* hex) */ int -color_to_bbggrr(const char *opt_color) +color_to_bbggrr(const char* opt_color) { int color_num; unsigned int i; - char *ep; + char* ep; color_num = strtol(opt_color, &ep, 10); diff --git a/gpsbabel/route.cc b/gpsbabel/route.cc index 6f2c735ff..1afb5d9e4 100644 --- a/gpsbabel/route.cc +++ b/gpsbabel/route.cc @@ -64,7 +64,7 @@ track_count(void) return trk_head_ct; /* total # of tracks */ } -route_head * +route_head* route_head_alloc(void) { route_head* rte_head = new route_head; @@ -75,7 +75,7 @@ route_head_alloc(void) } static void -any_route_free(route_head *rte) +any_route_free(route_head* rte) { if (rte->rte_name) { xfree(rte->rte_name); @@ -93,62 +93,62 @@ any_route_free(route_head *rte) static void -any_route_add_head(route_head *rte, queue *head) +any_route_add_head(route_head* rte, queue* head) { ENQUEUE_TAIL(head, &rte->Q); } static void -any_route_del_head(route_head *rte) +any_route_del_head(route_head* rte) { dequeue(&rte->Q); any_route_free(rte); } void -route_add_head(route_head *rte) +route_add_head(route_head* rte) { any_route_add_head(rte, &my_route_head); rte_head_ct++; } void -route_del_head(route_head *rte) +route_del_head(route_head* rte) { any_route_del_head(rte); rte_head_ct--; } void -track_add_head(route_head *rte) +track_add_head(route_head* rte) { any_route_add_head(rte, &my_track_head); trk_head_ct++; } void -track_del_head(route_head *rte) +track_del_head(route_head* rte) { any_route_del_head(rte); trk_head_ct--; } void -track_insert_head(route_head *rte, route_head *predecessor) +track_insert_head(route_head* rte, route_head* predecessor) { ENQUEUE_AFTER(&predecessor->Q, &rte->Q); trk_head_ct++; } static -route_head * -common_route_by_name(queue *routes, const char *name) +route_head* +common_route_by_name(queue* routes, const char* name) { - queue *elem, *tmp; - route_head *rte; + queue* elem, *tmp; + route_head* rte; QUEUE_FOR_EACH(routes, elem, tmp) { - rte = (route_head *) elem; + rte = (route_head*) elem; if (0 == strcmp(rte->rte_name, name)) { return rte; } @@ -157,20 +157,20 @@ common_route_by_name(queue *routes, const char *name) return NULL; } -route_head * -route_find_route_by_name(const char *name) +route_head* +route_find_route_by_name(const char* name) { return common_route_by_name(&my_route_head, name); } -route_head * -route_find_track_by_name(const char *name) +route_head* +route_find_track_by_name(const char* name) { return common_route_by_name(&my_track_head, name); } static void -any_route_add_wpt(route_head *rte, waypoint *wpt, int *ct, int synth) +any_route_add_wpt(route_head* rte, waypoint* wpt, int* ct, int synth) { ENQUEUE_TAIL(&rte->waypoint_list, &wpt->Q); rte->rte_waypt_ct++; /* waypoints in this route */ @@ -187,7 +187,7 @@ any_route_add_wpt(route_head *rte, waypoint *wpt, int *ct, int synth) } void -route_add_wpt(route_head *rte, waypoint *wpt) +route_add_wpt(route_head* rte, waypoint* wpt) { // First point in a route is always a new segment. // This improves compatibility when reading from @@ -200,7 +200,7 @@ route_add_wpt(route_head *rte, waypoint *wpt) } void -track_add_wpt(route_head *rte, waypoint *wpt) +track_add_wpt(route_head* rte, waypoint* wpt) { // First point in a track is always a new segment. // This improves compatibility when reading from @@ -212,13 +212,13 @@ track_add_wpt(route_head *rte, waypoint *wpt) any_route_add_wpt(rte, wpt, &trk_waypts, 0); } -waypoint * -route_find_waypt_by_name(route_head *rh, const char *name) +waypoint* +route_find_waypt_by_name(route_head* rh, const char* name) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { - waypoint *waypointp = (waypoint *) elem; + waypoint* waypointp = (waypoint*) elem; if (0 == strcmp(waypointp->shortname, name)) { return waypointp; } @@ -227,7 +227,7 @@ route_find_waypt_by_name(route_head *rh, const char *name) } static void -any_route_del_wpt(route_head *rte, waypoint *wpt, int *ct) +any_route_del_wpt(route_head* rte, waypoint* wpt, int* ct) { if (wpt->wpt_flags.new_trkseg && wpt != (waypoint*)QUEUE_LAST(&rte->waypoint_list)) { waypoint* wpt_next = (waypoint*)QUEUE_NEXT(&wpt->Q); @@ -242,50 +242,50 @@ any_route_del_wpt(route_head *rte, waypoint *wpt, int *ct) } void -route_del_wpt(route_head *rte, waypoint *wpt) +route_del_wpt(route_head* rte, waypoint* wpt) { any_route_del_wpt(rte, wpt, &rte_waypts); } void -track_del_wpt(route_head *rte, waypoint *wpt) +track_del_wpt(route_head* rte, waypoint* wpt) { any_route_del_wpt(rte, wpt, &trk_waypts); } void -route_disp(const route_head *rh, waypt_cb cb) +route_disp(const route_head* rh, waypt_cb cb) { - queue *elem, *tmp; + queue* elem, *tmp; if (!cb) { return; } QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { - waypoint *waypointp; - waypointp = (waypoint *) elem; + waypoint* waypointp; + waypointp = (waypoint*) elem; (*cb)(waypointp); } } void -route_reverse(const route_head *rte_hd) +route_reverse(const route_head* rte_hd) { /* Cast away const-ness */ - route_head *rh = (route_head *) rte_hd; - queue *elem, *tmp; + route_head* rh = (route_head*) rte_hd; + queue* elem, *tmp; QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem)); } } static void -common_disp_all(queue *qh, route_hdr rh, route_trl rt, waypt_cb wc) +common_disp_all(queue* qh, route_hdr rh, route_trl rt, waypt_cb wc) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { - const route_head *rhp; - rhp = (route_head *) elem; + const route_head* rhp; + rhp = (route_head*) elem; if (rh) { (*rh)(rhp); } @@ -297,12 +297,12 @@ common_disp_all(queue *qh, route_hdr rh, route_trl rt, waypt_cb wc) } static void -common_disp_session(const session_t *se, queue *qh, route_hdr rh, route_trl rt, waypt_cb wc) +common_disp_session(const session_t* se, queue* qh, route_hdr rh, route_trl rt, waypt_cb wc) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { - const route_head *rhp; - rhp = (route_head *) elem; + const route_head* rhp; + rhp = (route_head*) elem; if (rhp->session == se) { if (rh) { (*rh)(rhp); @@ -322,7 +322,7 @@ route_disp_all(route_hdr rh, route_trl rt, waypt_cb wc) } void -route_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc) +route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc) { common_disp_session(se, &my_route_head, rh, rt, wc); } @@ -334,20 +334,20 @@ track_disp_all(route_hdr rh, route_trl rt, waypt_cb wc) } void -track_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc) +track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc) { common_disp_session(se, &my_track_head, rh, rt, wc); } static void -route_flush_q(queue *head) +route_flush_q(queue* head) { - queue *elem, *tmp; - queue *q; + queue* elem, *tmp; + queue* q; QUEUE_FOR_EACH(head, elem, tmp) { q = dequeue(elem); - any_route_free((route_head *) q); + any_route_free((route_head*) q); } } @@ -375,34 +375,34 @@ route_flush_all() } void -route_flush(queue *head) +route_flush(queue* head) { - queue *elem, *tmp; - queue *q; + queue* elem, *tmp; + queue* q; QUEUE_FOR_EACH(head, elem, tmp) { q = dequeue(elem); - any_route_free((route_head *)q); + any_route_free((route_head*)q); } } void -route_copy(int *dst_count, int *dst_wpt_count, queue **dst, queue *src) +route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src) { - queue *elem, *tmp, *elem2, *tmp2; - route_head *rte_new; + queue* elem, *tmp, *elem2, *tmp2; + route_head* rte_new; int junk; if (!dst_wpt_count) { dst_wpt_count = &junk; } if (!*dst) { - *dst = (queue *)xcalloc(1, sizeof(queue)); + *dst = (queue*)xcalloc(1, sizeof(queue)); QUEUE_INIT(*dst); *dst_count = 0; *dst_wpt_count = 0; } QUEUE_FOR_EACH(src, elem, tmp) { - route_head *rte_old = (route_head *)elem; + route_head* rte_old = (route_head*)elem; rte_new = route_head_alloc(); rte_new->rte_name = xstrdup(rte_old->rte_name); @@ -412,57 +412,57 @@ route_copy(int *dst_count, int *dst_wpt_count, queue **dst, queue *src) rte_new->rte_num = rte_old->rte_num; any_route_add_head(rte_new, *dst); QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) { - any_route_add_wpt(rte_new, waypt_dupe((waypoint *)elem2), dst_wpt_count, 0); + any_route_add_wpt(rte_new, waypt_dupe((waypoint*)elem2), dst_wpt_count, 0); } (*dst_count)++; } } void -route_append(queue *src) +route_append(queue* src) { - queue *dst = &my_route_head; + queue* dst = &my_route_head; route_copy(&rte_head_ct, &rte_waypts, &dst, src); } void -track_append(queue *src) +track_append(queue* src) { - queue *dst = &my_track_head; + queue* dst = &my_track_head; route_copy(&trk_head_ct, &trk_waypts, &dst, src); } void -route_backup(signed int *count, queue **head_bak) +route_backup(signed int* count, queue** head_bak) { route_copy(count, NULL, head_bak, &my_route_head); } static void -route_restore_hdr(const route_head *rte) +route_restore_hdr(const route_head* rte) { rte_head_ct++; } static void -track_restore_hdr(const route_head *trk) +track_restore_hdr(const route_head* trk) { trk_head_ct++; } static void -route_restore_tlr(const route_head *rte) +route_restore_tlr(const route_head* rte) { } static void -route_restore_wpt(const waypoint *wpt) +route_restore_wpt(const waypoint* wpt) { rte_waypts++; } static void -track_restore_wpt(const waypoint *wpt) +track_restore_wpt(const waypoint* wpt) { trk_waypts++; } @@ -479,7 +479,7 @@ common_restore_finish(void) } void -route_restore(queue *head_bak) +route_restore(queue* head_bak) { if (head_bak == NULL) { return; @@ -493,13 +493,13 @@ route_restore(queue *head_bak) } void -track_backup(signed int *count, queue **head_bak) +track_backup(signed int* count, queue** head_bak) { route_copy(count, NULL, head_bak, &my_track_head); } void -track_restore(queue *head_bak) +track_restore(queue* head_bak) { if (head_bak == NULL) { return; @@ -519,10 +519,10 @@ track_restore(queue *head_bak) void routes_to_tracks(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&my_route_head, elem, tmp) { - route_head *trk = (route_head *) elem; + route_head* trk = (route_head*) elem; dequeue(&trk->Q); ENQUEUE_TAIL(&my_track_head, &trk->Q); } @@ -534,10 +534,10 @@ routes_to_tracks(void) void tracks_to_routes(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&my_track_head, elem, tmp) { - route_head *trk = (route_head *) elem; + route_head* trk = (route_head*) elem; dequeue(&trk->Q); ENQUEUE_TAIL(&my_route_head, &trk->Q); } @@ -552,19 +552,19 @@ tracks_to_routes(void) * If trkdatap is non-null upon entry, a pointer to an allocated collection * (hopefully interesting) statistics about the track will be placed there. */ -void track_recompute(const route_head *trk, computed_trkdata **trkdatap) +void track_recompute(const route_head* trk, computed_trkdata** trkdatap) { waypoint first; - waypoint *thisw; - waypoint *prev = &first; - queue *elem, *tmp; + waypoint* thisw; + waypoint* prev = &first; + queue* elem, *tmp; int tkpt = 0; int pts_hrt = 0; double tot_hrt = 0.0; int pts_cad = 0; double tot_cad = 0.0; char tkptname[100]; - computed_trkdata *tdata = (computed_trkdata *)xcalloc(1, sizeof(computed_trkdata)); + computed_trkdata* tdata = (computed_trkdata*)xcalloc(1, sizeof(computed_trkdata)); if (trkdatap) { *trkdatap = tdata; @@ -577,10 +577,10 @@ void track_recompute(const route_head *trk, computed_trkdata **trkdatap) tdata->min_alt = -unknown_alt; tdata->max_alt = unknown_alt; - QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) { + QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { double tlat, tlon, plat, plon, dist; - thisw = (waypoint *)elem; + thisw = (waypoint*)elem; /* * gcdist and heading want radians, not degrees. @@ -611,7 +611,7 @@ void track_recompute(const route_head *trk, computed_trkdata **trkdatap) prev->GetCreationTime().isValid() && thisw->GetCreationTime() > prev->GetCreationTime()) { double timed = - prev->GetCreationTime().msecsTo(thisw->GetCreationTime()) / 1000.0; + prev->GetCreationTime().msecsTo(thisw->GetCreationTime()) / 1000.0; WAYPT_SET(thisw, speed, dist / timed); } } diff --git a/gpsbabel/saroute.cc b/gpsbabel/saroute.cc index c6bcc24b4..3d6424f41 100644 --- a/gpsbabel/saroute.cc +++ b/gpsbabel/saroute.cc @@ -27,13 +27,13 @@ #include "defs.h" #include "grtcirc.h" -gbfile *infile; +gbfile* infile; -char *turns_important = NULL; -char *turns_only = NULL; -char *controls = NULL; -char *split = NULL; -char *timesynth = NULL; +char* turns_important = NULL; +char* turns_only = NULL; +char* controls = NULL; +char* split = NULL; +char* timesynth = NULL; int control = 0; @@ -66,23 +66,23 @@ arglist_t saroute_args[] = { #define ReadShort(f) gbfgetint16(f) #define ReadLong(f) gbfgetint32(f) -unsigned char * -ReadRecord(gbfile *f, gbsize_t size) +unsigned char* +ReadRecord(gbfile* f, gbsize_t size) { - unsigned char *result = (unsigned char *) xmalloc(size); + unsigned char* result = (unsigned char*) xmalloc(size); (void)gbfread(result, size, 1, f); return result; } void -Skip(gbfile * f, gbsize_t distance) +Skip(gbfile* f, gbsize_t distance) { gbfseek(f, distance, SEEK_CUR); } static void -rd_init(const char *fname) +rd_init(const char* fname) { infile = gbfopen(fname, "rb", MYNAME); if (split && (turns_important || turns_only)) { @@ -123,17 +123,17 @@ my_read(void) uint32_t outercount; uint32_t recsize; uint16_t stringlen; - unsigned char *record; + unsigned char* record; static int serial = 0; struct ll { int32_t lat; int32_t lon; } *latlon; uint16_t coordcount; - route_head *track_head = NULL; - route_head *old_track_head = NULL; - waypoint *wpt_tmp; - char *routename = NULL; + route_head* track_head = NULL; + route_head* old_track_head = NULL; + waypoint* wpt_tmp; + char* routename = NULL; double seglen = 0.0; int32_t starttime = 0; int32_t transittime = 0; @@ -163,9 +163,9 @@ my_read(void) */ record = ReadRecord(infile, recsize); - stringlen = le_read16((uint16_t *)(record + 0x1a)); + stringlen = le_read16((uint16_t*)(record + 0x1a)); if (stringlen) { - routename = (char *)xmalloc(stringlen + 1); + routename = (char*)xmalloc(stringlen + 1); routename[stringlen] = '\0'; memcpy(routename, record+0x1c, stringlen); } @@ -197,7 +197,7 @@ my_read(void) double lon; record = ReadRecord(infile, recsize); - latlon = (struct ll *)(record); + latlon = (struct ll*)(record); /* These records are backwards for some reason */ lat = (0x80000000UL - @@ -228,7 +228,7 @@ my_read(void) wpt_tmp->shortname = (char*) xmalloc(addrlen+1); wpt_tmp->shortname[addrlen]='\0'; - wpt_tmp->notes = (char *) xmalloc(cmtlen+1); + wpt_tmp->notes = (char*) xmalloc(cmtlen+1); wpt_tmp->notes[cmtlen] = '\0'; memcpy(wpt_tmp->notes, record+obase+4+addrlen, @@ -305,7 +305,7 @@ my_read(void) ReadShort(infile); recsize = ReadLong(infile); record = ReadRecord(infile, recsize); - stringlen = le_read16((uint16_t *)record); + stringlen = le_read16((uint16_t*)record); if (split && stringlen) { if (track_head->rte_waypt_ct) { old_track_head = track_head; @@ -318,9 +318,9 @@ my_read(void) } // end if if (!track_head->rte_name) { track_head->rte_name = - (char *)xmalloc(stringlen+1); + (char*)xmalloc(stringlen+1); strncpy(track_head->rte_name, - (const char *) record+2, stringlen); + (const char*) record+2, stringlen); track_head->rte_name[stringlen] = '\0'; } } @@ -328,16 +328,16 @@ my_read(void) if (timesynth) { seglen = le_read_double( record + 2 + stringlen + 0x08); - starttime = le_read32((uint32_t *) + starttime = le_read32((uint32_t*) (record + 2 + stringlen + 0x30)); - transittime = le_read32((uint32_t *) + transittime = le_read32((uint32_t*) (record + 2 + stringlen + 0x10)); seglen /= 5280*12*2.54/100000; /* to miles */ } - coordcount = le_read16((uint16_t *) + coordcount = le_read16((uint16_t*) (record + 2 + stringlen + 0x3c)); - latlon = (struct ll *)(record + 2 + stringlen + 0x3c + 2); + latlon = (struct ll*)(record + 2 + stringlen + 0x3c + 2); count--; if (count) { coordcount--; @@ -361,13 +361,13 @@ my_read(void) wpt_tmp->latitude = lat; wpt_tmp->longitude = -lon; if (stringlen && ((coordcount>1) || count)) { - wpt_tmp->shortname = (char *) xmalloc(stringlen+1); + wpt_tmp->shortname = (char*) xmalloc(stringlen+1); wpt_tmp->shortname[stringlen] = '\0'; memcpy(wpt_tmp->shortname, - ((char *)record)+2, + ((char*)record)+2, stringlen); } else { - wpt_tmp->shortname = (char *) xmalloc(7); + wpt_tmp->shortname = (char*) xmalloc(7); sprintf(wpt_tmp->shortname, "\\%5.5x", serial++); } @@ -438,7 +438,7 @@ my_read(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { fatal(MYNAME ":Not enough information is known about this format to write it.\n"); } diff --git a/gpsbabel/sbn.cc b/gpsbabel/sbn.cc index 35af7d63c..d9aba596a 100644 --- a/gpsbabel/sbn.cc +++ b/gpsbabel/sbn.cc @@ -25,7 +25,7 @@ #define MYNAME "sbn" -static gbfile *file_handle = NULL; +static gbfile* file_handle = NULL; static arglist_t sbn_args[] = { @@ -62,12 +62,12 @@ arglist_t sbn_args[] = { * instead of serial, and integers are read in big endian order. */ static size_t -read_packet(int *type, void *payload, size_t max_len) +read_packet(int* type, void* payload, size_t max_len) { size_t size, data_size; unsigned char start[4]; unsigned int checksum_exp, checksum_act; - unsigned char *data; + unsigned char* data; if (gbfread(start, sizeof(start), 1, file_handle) != 1) { if (gbfeof(file_handle)) { @@ -91,7 +91,7 @@ read_packet(int *type, void *payload, size_t max_len) data_size = size + 4; /* data_size can be up to about 64k */ - data = (unsigned char *) xmalloc(data_size); + data = (unsigned char*) xmalloc(data_size); if (gbfread(data, data_size, 1, file_handle) != 1) { fatal(MYNAME ": Format error: could not read %d bytes.\n", @@ -122,7 +122,7 @@ read_packet(int *type, void *payload, size_t max_len) #ifdef LOCOSYS_PARSE_FILE_ID static size_t -hdrcpy(char *dest, const char *src, size_t max_len) +hdrcpy(char* dest, const char* src, size_t max_len) { size_t i; @@ -136,7 +136,7 @@ hdrcpy(char *dest, const char *src, size_t max_len) #endif /* LOCOSYS_PARSE_FILE_ID */ int -locosys_decode_file_id(char *header, size_t len) +locosys_decode_file_id(char* header, size_t len) { #ifdef LOCOSYS_PARSE_FILE_ID /* @@ -153,7 +153,7 @@ locosys_decode_file_id(char *header, size_t len) char serial_num[INFO_SERIAL_NUM_LEN + 1]; char log_rate[INFO_LOG_RATE_LEN + 1]; char version[INFO_VERSION_LEN + 1]; - char *p = header; + char* p = header; p += hdrcpy(username, p, INFO_USERNAME_LEN); p += hdrcpy(serial_num, p, INFO_SERIAL_NUM_LEN); @@ -170,7 +170,7 @@ locosys_decode_file_id(char *header, size_t len) } static void -read_sbn_header(route_head *track) +read_sbn_header(route_head* track) { char header[QRY_INFORMATION_LEN]; size_t len; @@ -186,7 +186,7 @@ read_sbn_header(route_head *track) } static int -is_sbn_valid(const unsigned char *buffer) +is_sbn_valid(const unsigned char* buffer) { /* valid navigation (any bit set implies navigation solution is not * optimal) */ @@ -194,7 +194,7 @@ is_sbn_valid(const unsigned char *buffer) } static fix_type -decode_sbn_mode(const unsigned char *mode) +decode_sbn_mode(const unsigned char* mode) { static const fix_type fixes[8] = { fix_none, /* 000 No Nav */ @@ -213,7 +213,7 @@ decode_sbn_mode(const unsigned char *mode) } static void -decode_sbn_datetime(const unsigned char *buffer, waypoint *waypt) +decode_sbn_datetime(const unsigned char* buffer, waypoint* waypt) { struct tm tm; int ms = be_readu16(buffer + 6); @@ -229,17 +229,17 @@ decode_sbn_datetime(const unsigned char *buffer, waypoint *waypt) } static void -decode_sbn_position(const unsigned char *buffer, waypoint *waypt) +decode_sbn_position(const unsigned char* buffer, waypoint* waypt) { waypt->latitude = be_read32(buffer + 0) * 0.0000001; waypt->longitude = be_read32(buffer + 4) * 0.0000001; waypt->altitude = be_read32(buffer + 12) * 0.01; } -static waypoint * -decode_sbn_record(unsigned char *buffer) +static waypoint* +decode_sbn_record(unsigned char* buffer) { - waypoint *waypt = NULL; + waypoint* waypt = NULL; waypt = waypt_new(); if (is_sbn_valid(buffer)) { @@ -259,7 +259,7 @@ decode_sbn_record(unsigned char *buffer) } static void -add_logpoints(route_head *track) +add_logpoints(route_head* track) { unsigned char buffer[SBN_RECORD_LEN]; int type = 0; @@ -279,7 +279,7 @@ add_logpoints(route_head *track) /**********************************************************************/ static void -sbn_rd_init(const char *fname) +sbn_rd_init(const char* fname) { file_handle = gbfopen(fname, "r", MYNAME); } @@ -294,7 +294,7 @@ static void sbn_read(void) { if (global_opts.masked_objective & TRKDATAMASK) { - route_head *track; + route_head* track; track = route_head_alloc(); track_add_head(track); diff --git a/gpsbabel/sbp.cc b/gpsbabel/sbp.cc index 1daa00d4a..afb64c596 100644 --- a/gpsbabel/sbp.cc +++ b/gpsbabel/sbp.cc @@ -26,7 +26,7 @@ #define MYNAME "sbp" -static gbfile *file_handle = NULL; +static gbfile* file_handle = NULL; static arglist_t sbp_args[] = { @@ -38,7 +38,7 @@ arglist_t sbp_args[] = { *******************************************************************************/ static void -sbp_rd_init(const char *fname) +sbp_rd_init(const char* fname) { file_handle = gbfopen(fname, "r", MYNAME); } @@ -50,7 +50,7 @@ sbp_rd_deinit(void) } static void -read_sbp_header(route_head *track) +read_sbp_header(route_head* track) { /* * A complete SBP file contains 64 bytes header, @@ -83,7 +83,7 @@ read_sbp_header(route_head *track) } } -static waypoint * +static waypoint* read_logpoint(void) { unsigned char buffer[SBP_RECORD_LEN]; @@ -99,8 +99,8 @@ static void sbp_read(void) { if (global_opts.masked_objective & TRKDATAMASK) { - waypoint *logpoint; - route_head *track; + waypoint* logpoint; + route_head* track; track = route_head_alloc(); track_add_head(track); diff --git a/gpsbabel/session.cc b/gpsbabel/session.cc index 9c1a3cf87..b1511b1c8 100644 --- a/gpsbabel/session.cc +++ b/gpsbabel/session.cc @@ -25,7 +25,7 @@ static queue session_list; static int session_ct; -static void session_free(session_t *s); +static void session_free(session_t* s); void session_init(void) @@ -37,19 +37,19 @@ session_init(void) void session_exit(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&session_list, elem, tmp) { - session_t *s = (session_t *)elem; + session_t* s = (session_t*)elem; dequeue(&s->Q); session_free(s); } } void -start_session(const char *name, const char *filename) +start_session(const char* name, const char* filename) { - session_t *s; + session_t* s; if (session_ct == 0) { QUEUE_INIT(&session_list); @@ -64,10 +64,10 @@ start_session(const char *name, const char *filename) s->filename = xstrdup(filename); } -session_t * +session_t* curr_session(void) { - return (session_t *) session_list.prev; + return (session_t*) session_list.prev; } /* in work @@ -105,11 +105,11 @@ session_add_category(const char *name, const int id) /* non public functions */ static void -session_free(session_t *s) +session_free(session_t* s) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&s->category_list, elem, tmp) { - category_t *c = (category_t *) elem; + category_t* c = (category_t*) elem; dequeue(&c->Q); xfree(c); } diff --git a/gpsbabel/shape.cc b/gpsbabel/shape.cc index 0ae8ff3b4..f5aa921b7 100644 --- a/gpsbabel/shape.cc +++ b/gpsbabel/shape.cc @@ -29,15 +29,15 @@ static SHPHandle ohandle; #define MYNAME "shape" static unsigned poly_count; -static double *polybufx; -static double *polybufy; -static double *polybufz; -static const char *ofname; +static double* polybufx; +static double* polybufy; +static double* polybufz; +static const char* ofname; static int nameidx; static int urlidx; -static char *opt_name = NULL; -static char *opt_url = NULL; +static char* opt_name = NULL; +static char* opt_url = NULL; static arglist_t shp_args[] = { @@ -53,7 +53,7 @@ arglist_t shp_args[] = { }; static void -my_rd_init(const char *fname) +my_rd_init(const char* fname) { ihandle = SHPOpen(fname, "rb"); if (ihandle == NULL) { @@ -70,7 +70,7 @@ my_rd_init(const char *fname) int nFields = 0; int i = 0; char name[12]; - char *txt = xstrdup(" Database fields\n"); + char* txt = xstrdup(" Database fields\n"); nFields = DBFGetFieldCount(ihandledb); for (i = 0; i < nFields; i++) { char txtName[50]; @@ -112,17 +112,17 @@ void my_read(void) { int npts; - const char *etype = "unknown"; + const char* etype = "unknown"; SHPGetInfo(ihandle, &npts, NULL, NULL, NULL); while (npts) { - SHPObject *shp; - waypoint *wpt; - const char *name = ""; - const char *url; - char *tmpName = NULL; - char *tmpIndex = opt_name; + SHPObject* shp; + waypoint* wpt; + const char* name = ""; + const char* url; + char* tmpName = NULL; + char* tmpIndex = opt_name; shp = SHPReadObject(ihandle, npts-1); if (nameidx >0) { @@ -134,7 +134,7 @@ my_read(void) tmpName = xstrdup(""); tmpIndex = opt_name; while (tmpIndex) { - char *tmp2 = tmpIndex; + char* tmp2 = tmpIndex; tmpIndex = strchr(tmpIndex,'+'); if (tmpIndex) { *tmpIndex = '\0'; @@ -168,7 +168,7 @@ my_read(void) switch (shp->nSHPType) { case SHPT_ARC: { int j; - route_head *routehead = route_head_alloc(); + route_head* routehead = route_head_alloc(); routehead->rte_name = xstrdup(name); route_add_head(routehead); for (j = 0; j < shp->nVertices; j++) { @@ -251,7 +251,7 @@ my_rd_deinit(void) } void -my_wr_init(const char *fname) +my_wr_init(const char* fname) { ofname = fname; } @@ -263,20 +263,20 @@ my_wr_deinit(void) } void -my_write_wpt(const waypoint *wpt) +my_write_wpt(const waypoint* wpt) { - SHPObject *shpobject; + SHPObject* shpobject; shpobject = SHPCreateSimpleObject(SHPT_POINT, 1, - (double *)(void *)&wpt->longitude, - (double *)(void *)&wpt->latitude, - (double *)(void *)&wpt->altitude); + (double*)(void*)&wpt->longitude, + (double*)(void*)&wpt->latitude, + (double*)(void*)&wpt->altitude); SHPWriteObject(ohandle, -1, shpobject); SHPDestroyObject(shpobject); } void -poly_init(const route_head *h) +poly_init(const route_head* h) { int ct = track_waypt_count(); polybufx = (double*) xcalloc(ct, sizeof(double)); @@ -286,7 +286,7 @@ poly_init(const route_head *h) void -poly_point(const waypoint *wpt) +poly_point(const waypoint* wpt) { polybufx[poly_count] = wpt->longitude; polybufy[poly_count] = wpt->latitude; @@ -295,9 +295,9 @@ poly_point(const waypoint *wpt) } void -poly_deinit(const route_head *h) +poly_deinit(const route_head* h) { - SHPObject *shpobject; + SHPObject* shpobject; shpobject = SHPCreateSimpleObject(SHPT_ARC, track_waypt_count(), polybufx, polybufy, polybufz); SHPWriteObject(ohandle, -1, shpobject); diff --git a/gpsbabel/shortname.cc b/gpsbabel/shortname.cc index 35a3ab3c3..a02d4d2d6 100644 --- a/gpsbabel/shortname.cc +++ b/gpsbabel/shortname.cc @@ -6,8 +6,8 @@ const QString kVowels("aeiou"); static struct replacements { - const char *orig; - const char *replacement; + const char* orig; + const char* replacement; } replacements[] = { {"zero", "0"}, {"one", "1"}, @@ -24,16 +24,18 @@ static struct replacements { QString Shortname::DeleteLastVowel(int start, const QString& s, - bool& replaced) { - QString out = s; - replaced = false; + bool& replaced) +{ + QString out = s; + replaced = false; #if 1 for (int i = s.length() -1; i > start; i--) { QChar c = s[i]; // Preserve vowel if first of a word. if (i > 0) { - if (s[i-1].isSpace()) + if (s[i-1].isSpace()) { continue; + } } if (kVowels.contains(c, Qt::CaseInsensitive)) { out = out.remove(i, 1); @@ -44,15 +46,16 @@ QString Shortname::DeleteLastVowel(int start, const QString& s, return out; } -QString Shortname::Replace(const QString& in) { +QString Shortname::Replace(const QString& in) +{ QString out = in; - struct replacements *r; + struct replacements* r; for (r = replacements; r->orig; r++) { // while(int i = out.indexOf(r->orig, 1) > 2) { - int i = out.indexOf(r->orig, 1); - if(i > 1) { -fprintf(stderr, "%d\n", i); + int i = out.indexOf(r->orig, 1); + if (i > 1) { + fprintf(stderr, "%d\n", i); if (out[i-1] == ' ') { out = out.replace(i, strlen(r->orig), r->replacement); } @@ -61,7 +64,8 @@ fprintf(stderr, "%d\n", i); return out; } -QString Shortname::Shorten(const QString& in) { +QString Shortname::Shorten(const QString& in) +{ // Eliminate leading and trailing whitespace and replace internal // whitespace sequences (tabs, multiple spaces, etc.) with a single space. QString out = in.simplified(); @@ -110,210 +114,210 @@ QString Shortname::Shorten(const QString& in) { while (name_list_.contains(t)) { printf("Conflict %d\n", conflict_counter_); QString trailer = QString(".%1").arg(conflict_counter_); -fprintf(stderr, "Trailer: %s\n", qPrintable(trailer)); + fprintf(stderr, "Trailer: %s\n", qPrintable(trailer)); t.truncate(target_len_ - trailer.length()); -fprintf(stderr, "Truncate: %s\n", qPrintable(t)); + fprintf(stderr, "Truncate: %s\n", qPrintable(t)); t = t.append(trailer); conflict_counter_++; } out = t; name_list_.insert(out); } - fprintf(stderr, "Returning %s\n", qPrintable(out)); + fprintf(stderr, "Returning %s\n", qPrintable(out)); assert(out.length() <= target_len_); return out; } #if 1 -char *foo[] = { -"VwthPst# 3700.706N 08627.588W 0000000m View the Past #2 ", -"PilotRoc 3655.270N 08717.173W 0000000m Pilot Rock ", -"MrCycsNg 3652.407N 08728.890W 0000000m Mr. Cayces Neighborhood ", -"SOLDIER 3640.691N 08726.660W 0000000m SOLDIER’S TRIBUTE ", -"ZOOMZOOM 3636.659N 08721.793W 0000000m ZOOM ZOOM ZOOM by Feros Family", -"SOCLOSEB 3636.494N 08722.086W 0000000m SO CLOSE BUT YET by Kyle of Fe", -"InSrchfS 3636.363N 08636.363W 0000000m In Search of Steam by BigHank ", -"RdBlngSp 3632.119N 08550.956W 0000000m Red Boiling Springs by Firedog", -"HelngWtr 3631.729N 08550.481W 0000000m Healing Waters by FiredogPotte", -"AHHtheVi 3629.020N 08533.891W 0000000m ogPotter ", -"LstCrkCc 3628.167N 08801.656W 0000000m Lost Creek Cache by Paul Kathy", -"DlvrncTr 3626.412N 08729.249W 0000000m Deliverance Train by Team Skay", -"FrQrtrRn 3438.502N 08646.926W 0000000m Four Quarter Rendezvous by Zay", -"Jstlttlc 3620.647N 08814.298W 0000000m Just a little cache by Paul Ka", -"BrryPtch 3618.786N 08616.344W 0000000m Berry Patch Cache by White Dog", -"AStrllDw 3342.752N 08630.829W 0000000m A Stroll Down Memory Lane by t", -"QunfTnns 3606.413N 08651.962W 0000000m Queen of Tennessee by A182pilo", -"GoneFish 3618.199N 08655.171W 0000000m Gone Fishin' by White Dog Pack", -"GrnwysFn 3610.942N 08642.061W 0000000m Greenways Fence by Ukulele And", -"AStnsThr 3611.240N 08638.324W 0000000m A Stone's Throw by Murrcat & S", -"Nashvlls 3617.112N 08642.359W 0000000m Nashville's Zoo by White Dog P", -"BltzMcr4 3517.127N 08622.211W 0000000m Blitz Micro Number 4 ", -"NkdnthWn 3437.145N 08651.693W 0000000m Naked in the Wind by Zaybex ", -"ANcPlctR 3603.389N 08654.418W 0000000m A Nice Place to Rest by JoGPS ", -"welcomtT 3638.155N 08720.130W 0000000m welcome to TN by Raf of the se", -"welcomtK 3638.956N 08721.011W 0000000m welcome to KY by raf of the se", -"BltzMcr5 3506.191N 08634.277W 0000000m Blitz Micro Number 5 ", -"JmsFmlyG 3615.887N 08649.846W 0000000m James Family Grocery by White ", -"seekngrf 3629.262N 08742.333W 0000000m seekeing refuge by raf of the ", -"SecrtFll 3614.927N 08534.180W 0000000m Secret Falls ", -"ApstlcTh 3613.870N 08645.108W 0000000m Apostolic Thistle Walk by Jame", -"WllIllBD 3609.258N 08637.268W 0000000m Well....I'll Be \"Dammed\" byi", -"BettysBt 3608.857N 08550.564W 0000000m Betty's Booty by White Dog Pac", -"SmthngSm 3439.748N 08643.522W 0000000m Something Smells Fishy by Zayb", -"RckyRd(C 3605.315N 08549.326W 0000000m Rocky Road (Center Hill Lake) ", -"Brdwtchr 3436.605N 08651.243W 0000000m Birdwatcher's Dream by Zaybex ", -"JcksnsHl 3605.185N 08619.439W 0000000m Jackson's Halls by White Dog P", -"FrgttnP2 3509.599N 08633.282W 0000000m Forgotten Park 2 ", -"SOLDIERS 3640.691N 08726.660W 0000000m SOLDIERS TRIBUTE by Feros Fami", -"EndofRop 3433.820N 08650.460W 0000000m End of Rope by Big Rock ", -"VwthPst1 3659.263N 08627.114W 0000000m View the Past #1 ", -"VwthPst2 3700.706N 08627.588W 0000000m View the Past #2 ", -"Trash#8 3603.102N 08655.144W 0000000m Cache In Trash Out # 8 ", -"SlwwwwCc 3602.543N 08535.953W 0000000m Sloowwww Cache by Tntcacher ", -"Leavttbv 3602.514N 08638.686W 0000000m Leave it to beaver by A182pilo", -"WhrrthHr 3436.594N 08654.759W 0000000m Where are the Horses? by Zaybe", -"ButtonCc 3433.401N 08645.294W 0000000m Button Cache by Zaybex ", -"MrcsLbrr 3436.842N 08655.972W 0000000m Marco's Library by Marco ", -"Octopus 3526.743N 08534.757W 0000000m Octopus by White Dog Pack ", -"WtrFllsV 3544.140N 08527.861W 0000000m Water Falls Valley by Cave Rat", -"DeddrpPn 3448.126N 08719.696W 0000000m Dead-drop Pink by Marco ", -"JWhlrRvr 3448.157N 08719.914W 0000000m Joe Wheeler River Walk by Marc", -"CvSprngs 3432.797N 08651.084W 0000000m Cave Springs Cache by Marco.. ", -"CnyFrkOv 3550.876N 08518.446W 0000000m Fork Overlook ", -"SheepsCa 3550.527N 08519.480W 0000000m Sheep's Cave ", -"VrgnFlls 3550.308N 08519.904W 0000000m Virgin Falls Cache ", -"ShrtctVr 3550.170N 08519.590W 0000000m Shortcut Virtual ", -"KlylFlls 3549.105N 08539.814W 0000000m Klaylee Falls Cache by pattytr", -"FshngfrB 3548.923N 08538.558W 0000000m BADGER by M&Mk ", -"TpfthHll 3548.808N 08601.722W 0000000m Top of the Hill Pet Cache by M", -"TwnFllsC 3548.560N 08537.996W 0000000m Twin Falls Cache by SLCREW a", -"WtchsCst 3548.197N 08537.673W 0000000m Witch's Castle Keys by SLCREW ", -"ThatCave 3544.901N 08522.854W 0000000m That Cave by JaDan150 and AprJ", -"BssltwnW 3541.174N 08801.489W 0000000m Busseltown Wildlife Refuge by ", -"Riverfrn 3540.968N 08546.995W 0000000m Riverfront by SLCREW and M&M", -"Basement 3540.086N 08521.304W 0000000m The Basement ", -"EfflTwrC 3617.132N 08818.371W 0000000m Eiffel Tower Cache by Dick Wan", -"KeyholeC 3544.562N 08524.098W 0000000m Keyhole Cave by Cave Rat ", -"(MC^2)Mn 3444.990N 08630.218W 0000000m (MC^2) Monte Sano Cuts Cache b", -"WildctCc 3636.823N 08808.087W 0000000m Wildcat Cache by The Storm ", -"NAlbm/Tn 3444.365N 08632.688W 0000000m N. Alabama / Tennessee Valley ", -"CalebsCa 3444.215N 08633.103W 0000000m Caleb's Cave by Papaw and Cale", -"MntSnPrs 3444.201N 08632.591W 0000000m Monte Sano Preserve by Evan & ", -"FltRckFl 3444.475N 08629.958W 0000000m Flat Rock Falls Cache by Jason", -"PanormCc 3443.961N 08631.638W 0000000m The Panorama Cache by IHTFP an", -"TnnssScv 3602.861N 08652.751W 0000000m Tennessee Scavenger Hunt Cache", -"Geocache 3435.209N 08655.968W 0000000m Geocache by Papaw & Caleb ", -"Skellig 3444.100N 08656.566W 0000000m Skellig by Zaybex ", -"Deceptio 3433.450N 08655.711W 0000000m Deception by Papaw and Caleb ", -"AwlknthD 3433.310N 08655.635W 0000000m A walk in the Desert by Papa", -"MiniMsQs 3558.934N 08650.674W 0000000m Mini Me's Quest by CrotalusRex", -"BakrsBlf 3541.891N 08717.300W 0000000m Bakers Bluff by Flower Child &", -"GoFlyAKi 3435.664N 08659.267W 0000000m Go Fly A Kite by Marco.. ", -"FlntCrkA 3432.028N 08656.806W 0000000m Flint Creek Adventure by Marco", -"HonordMn 3534.680N 08612.557W 0000000m Honored Mount by Southpaw ", -"SafariZo 3440.697N 08700.774W 0000000m Safari Zone by Zaybex ", -"JckDnlsC 3517.077N 08622.260W 0000000m Jack Daniels Cache by Rmearse ", -"FrgttnPr 3509.599N 08633.282W 0000000m Forgotten Park ", -"DntOvrlk 3513.326N 08616.031W 0000000m Dont Overlook Me Cache ", -"ArYStmpd 3513.039N 08615.110W 0000000m Are You Stumped Yet? cache ", -"CchtthBn 3512.532N 08614.691W 0000000m Cache at the Bend ", -"Thtsnkng 3609.009N 08530.314W 0000000m That sinking feeling by Tntcac", -"GamersCc 3449.136N 08635.836W 0000000m mer's Cache by avoral ", -"CchMIfYC 3452.455N 08620.648W 0000000m Cache Me If You Can! by Glen H", -"SavageVs 3526.915N 08535.136W 0000000m Savage Vista by White Dog Pack", -"PrtrnG15 3555.479N 08653.274W 0000000m Praetorian Guards Hail Caesar #15!", -"WtrlnAmp 3443.722N 08632.535W 0000000m Waterline Amphitheater by Fath", -"BysLttlC 3447.569N 08638.448W 0000000m Boys' Little Cache by Zaybex ", -"DrgnsBrt 3443.779N 08635.188W 0000000m Dragon's Breath by Zaybex ", -"CryBbyHl 3430.733N 08657.362W 0000000m Cry Baby Hollow Cache by La Pa", -"Parmer 3606.218N 08651.590W 0000000m Parmer by A182pilot & Family ", -"JnnfrndJ 3438.141N 08632.991W 0000000m Jennifer and Jonathans Cliff C", -"ALDRIDGE 3435.305N 08632.868W 0000000m ALDRIDGE CREEK LOTTA LOOT!! by", -"RcktCtyS 3440.032N 08631.352W 0000000m Rocket City Stash by David Upt", -"TrgcAccd 3608.561N 08648.381W 0000000m Tragic Accident by Campaholics", -"FALLENTR 3439.210N 08631.104W 0000000m FALLEN TREE 4 MILE POST by zac", -"TrshOt15 3558.964N 08646.064W 0000000m Cache In Trash Out # 15 ", -"TrshOt13 3602.214N 08650.428W 0000000m Cache In Trash Out #13 ", -"PrcysDrp 3604.312N 08653.465W 0000000m Percys Dripping Springs by KLi", -"TrshOt14 3605.292N 08648.560W 0000000m Cache In Trash Out # 14 ", -"PrtrnGr5 3557.621N 08640.278W 0000000m Praetorian Guards Hail Caesar #5!", -"PrtrnGr4 3557.370N 08640.201W 0000000m Praetorian Guards Hail Caesar #4!", -"PrtrnGr3 3557.250N 08640.047W 0000000m Praetorian Guards Hail Caesar #3!", -"GrnMntnC 3439.120N 08631.100W 0000000m Green Mountain Cache by Steve ", -"TrshOt12 3605.330N 08635.817W 0000000m Cache In Trash Out #12 ", -"BlncngAc 3608.579N 08648.120W 0000000m Balancing Act by Campaholics ", -"DittoCac 3434.652N 08633.310W 0000000m Ditto Cache by mookey ", -"EraserCc 3431.888N 08633.024W 0000000m Eraser Cache by Zaybex ", -"FrMlPstE 3439.440N 08630.180W 0000000m Four Mile Post Extension Cache", -"MllrdFxC 3439.578N 08706.552W 0000000m Mallard-Fox Creek Cache by bam", -"FireCach 3443.908N 08630.318W 0000000m he by Glen Pam Chase M ", -"FlntRvrC 3443.170N 08625.990W 0000000m Flint River Canoe Cache by Ran", -"ArabinCc 3419.104N 08628.765W 0000000m The Arabian Cache by WesNSpace", -"CvrdBrdg 3412.406N 08659.392W 0000000m Covered Bridge Cache by pmarkh", -"MilesTCc 3424.470N 08611.720W 0000000m Miles Too Cache by Rmearse ", -"MbryOvrl 3423.803N 08611.922W 0000000m Mabrey Overlook Me by DDVaughn", -"LwEnfrcm 3423.218N 08612.258W 0000000m Law Enforcement Cache by DDVau", -"GrndDddy 3423.128N 08612.025W 0000000m Grand Daddys Home by Rmearse ", -"BamaCach 3421.459N 08611.686W 0000000m The Bama Cache by DDVaughn & T", -"Canyons 3440.085N 08600.910W 0000000m The Canyons by Aubrey and Josh", -"ADamGodV 3511.677N 08616.587W 0000000m A Dam Good View by mdawg & muf", -"UNDERTHE 3446.918N 08739.790W 0000000m UNDER THE ROCK by RUNNINGWILD ", -"SQUIRREL 3448.712N 08741.681W 0000000m SQUIRREL'S NEST by RUNNINGWILD", -"WlknthPr 3448.273N 08741.844W 0000000m Walk in the Park by Runningwil", -"NetsClue 3448.494N 08741.977W 0000000m Net's Clues by Runningwild Adv", -"NatrlBrd 3405.583N 08736.909W 0000000m Natural Bridge by Southeast Xt", -"TrnglPrk 3341.448N 08640.980W 0000000m Triangle Park Cache by Charles", -"LttlRvrI 3421.855N 08539.597W 0000000m Little River Initiative by spa", -"GimmShlt 3430.087N 08536.834W 0000000m Gimme Shelter by Big Rock & Po", -"GnomeTrs 3433.081N 08535.849W 0000000m Gnome Treasure by Big Rock ", -"FlyingTr 3608.594N 08648.179W 0000000m Flying Torso by Campaholics ", -"CultivtC 3608.582N 08648.064W 0000000m Cultivate a Cure by Campahol" +char* foo[] = { + "VwthPst# 3700.706N 08627.588W 0000000m View the Past #2 ", + "PilotRoc 3655.270N 08717.173W 0000000m Pilot Rock ", + "MrCycsNg 3652.407N 08728.890W 0000000m Mr. Cayces Neighborhood ", + "SOLDIER 3640.691N 08726.660W 0000000m SOLDIER’S TRIBUTE ", + "ZOOMZOOM 3636.659N 08721.793W 0000000m ZOOM ZOOM ZOOM by Feros Family", + "SOCLOSEB 3636.494N 08722.086W 0000000m SO CLOSE BUT YET by Kyle of Fe", + "InSrchfS 3636.363N 08636.363W 0000000m In Search of Steam by BigHank ", + "RdBlngSp 3632.119N 08550.956W 0000000m Red Boiling Springs by Firedog", + "HelngWtr 3631.729N 08550.481W 0000000m Healing Waters by FiredogPotte", + "AHHtheVi 3629.020N 08533.891W 0000000m ogPotter ", + "LstCrkCc 3628.167N 08801.656W 0000000m Lost Creek Cache by Paul Kathy", + "DlvrncTr 3626.412N 08729.249W 0000000m Deliverance Train by Team Skay", + "FrQrtrRn 3438.502N 08646.926W 0000000m Four Quarter Rendezvous by Zay", + "Jstlttlc 3620.647N 08814.298W 0000000m Just a little cache by Paul Ka", + "BrryPtch 3618.786N 08616.344W 0000000m Berry Patch Cache by White Dog", + "AStrllDw 3342.752N 08630.829W 0000000m A Stroll Down Memory Lane by t", + "QunfTnns 3606.413N 08651.962W 0000000m Queen of Tennessee by A182pilo", + "GoneFish 3618.199N 08655.171W 0000000m Gone Fishin' by White Dog Pack", + "GrnwysFn 3610.942N 08642.061W 0000000m Greenways Fence by Ukulele And", + "AStnsThr 3611.240N 08638.324W 0000000m A Stone's Throw by Murrcat & S", + "Nashvlls 3617.112N 08642.359W 0000000m Nashville's Zoo by White Dog P", + "BltzMcr4 3517.127N 08622.211W 0000000m Blitz Micro Number 4 ", + "NkdnthWn 3437.145N 08651.693W 0000000m Naked in the Wind by Zaybex ", + "ANcPlctR 3603.389N 08654.418W 0000000m A Nice Place to Rest by JoGPS ", + "welcomtT 3638.155N 08720.130W 0000000m welcome to TN by Raf of the se", + "welcomtK 3638.956N 08721.011W 0000000m welcome to KY by raf of the se", + "BltzMcr5 3506.191N 08634.277W 0000000m Blitz Micro Number 5 ", + "JmsFmlyG 3615.887N 08649.846W 0000000m James Family Grocery by White ", + "seekngrf 3629.262N 08742.333W 0000000m seekeing refuge by raf of the ", + "SecrtFll 3614.927N 08534.180W 0000000m Secret Falls ", + "ApstlcTh 3613.870N 08645.108W 0000000m Apostolic Thistle Walk by Jame", + "WllIllBD 3609.258N 08637.268W 0000000m Well....I'll Be \"Dammed\" byi", + "BettysBt 3608.857N 08550.564W 0000000m Betty's Booty by White Dog Pac", + "SmthngSm 3439.748N 08643.522W 0000000m Something Smells Fishy by Zayb", + "RckyRd(C 3605.315N 08549.326W 0000000m Rocky Road (Center Hill Lake) ", + "Brdwtchr 3436.605N 08651.243W 0000000m Birdwatcher's Dream by Zaybex ", + "JcksnsHl 3605.185N 08619.439W 0000000m Jackson's Halls by White Dog P", + "FrgttnP2 3509.599N 08633.282W 0000000m Forgotten Park 2 ", + "SOLDIERS 3640.691N 08726.660W 0000000m SOLDIERS TRIBUTE by Feros Fami", + "EndofRop 3433.820N 08650.460W 0000000m End of Rope by Big Rock ", + "VwthPst1 3659.263N 08627.114W 0000000m View the Past #1 ", + "VwthPst2 3700.706N 08627.588W 0000000m View the Past #2 ", + "Trash#8 3603.102N 08655.144W 0000000m Cache In Trash Out # 8 ", + "SlwwwwCc 3602.543N 08535.953W 0000000m Sloowwww Cache by Tntcacher ", + "Leavttbv 3602.514N 08638.686W 0000000m Leave it to beaver by A182pilo", + "WhrrthHr 3436.594N 08654.759W 0000000m Where are the Horses? by Zaybe", + "ButtonCc 3433.401N 08645.294W 0000000m Button Cache by Zaybex ", + "MrcsLbrr 3436.842N 08655.972W 0000000m Marco's Library by Marco ", + "Octopus 3526.743N 08534.757W 0000000m Octopus by White Dog Pack ", + "WtrFllsV 3544.140N 08527.861W 0000000m Water Falls Valley by Cave Rat", + "DeddrpPn 3448.126N 08719.696W 0000000m Dead-drop Pink by Marco ", + "JWhlrRvr 3448.157N 08719.914W 0000000m Joe Wheeler River Walk by Marc", + "CvSprngs 3432.797N 08651.084W 0000000m Cave Springs Cache by Marco.. ", + "CnyFrkOv 3550.876N 08518.446W 0000000m Fork Overlook ", + "SheepsCa 3550.527N 08519.480W 0000000m Sheep's Cave ", + "VrgnFlls 3550.308N 08519.904W 0000000m Virgin Falls Cache ", + "ShrtctVr 3550.170N 08519.590W 0000000m Shortcut Virtual ", + "KlylFlls 3549.105N 08539.814W 0000000m Klaylee Falls Cache by pattytr", + "FshngfrB 3548.923N 08538.558W 0000000m BADGER by M&Mk ", + "TpfthHll 3548.808N 08601.722W 0000000m Top of the Hill Pet Cache by M", + "TwnFllsC 3548.560N 08537.996W 0000000m Twin Falls Cache by SLCREW a", + "WtchsCst 3548.197N 08537.673W 0000000m Witch's Castle Keys by SLCREW ", + "ThatCave 3544.901N 08522.854W 0000000m That Cave by JaDan150 and AprJ", + "BssltwnW 3541.174N 08801.489W 0000000m Busseltown Wildlife Refuge by ", + "Riverfrn 3540.968N 08546.995W 0000000m Riverfront by SLCREW and M&M", + "Basement 3540.086N 08521.304W 0000000m The Basement ", + "EfflTwrC 3617.132N 08818.371W 0000000m Eiffel Tower Cache by Dick Wan", + "KeyholeC 3544.562N 08524.098W 0000000m Keyhole Cave by Cave Rat ", + "(MC^2)Mn 3444.990N 08630.218W 0000000m (MC^2) Monte Sano Cuts Cache b", + "WildctCc 3636.823N 08808.087W 0000000m Wildcat Cache by The Storm ", + "NAlbm/Tn 3444.365N 08632.688W 0000000m N. Alabama / Tennessee Valley ", + "CalebsCa 3444.215N 08633.103W 0000000m Caleb's Cave by Papaw and Cale", + "MntSnPrs 3444.201N 08632.591W 0000000m Monte Sano Preserve by Evan & ", + "FltRckFl 3444.475N 08629.958W 0000000m Flat Rock Falls Cache by Jason", + "PanormCc 3443.961N 08631.638W 0000000m The Panorama Cache by IHTFP an", + "TnnssScv 3602.861N 08652.751W 0000000m Tennessee Scavenger Hunt Cache", + "Geocache 3435.209N 08655.968W 0000000m Geocache by Papaw & Caleb ", + "Skellig 3444.100N 08656.566W 0000000m Skellig by Zaybex ", + "Deceptio 3433.450N 08655.711W 0000000m Deception by Papaw and Caleb ", + "AwlknthD 3433.310N 08655.635W 0000000m A walk in the Desert by Papa", + "MiniMsQs 3558.934N 08650.674W 0000000m Mini Me's Quest by CrotalusRex", + "BakrsBlf 3541.891N 08717.300W 0000000m Bakers Bluff by Flower Child &", + "GoFlyAKi 3435.664N 08659.267W 0000000m Go Fly A Kite by Marco.. ", + "FlntCrkA 3432.028N 08656.806W 0000000m Flint Creek Adventure by Marco", + "HonordMn 3534.680N 08612.557W 0000000m Honored Mount by Southpaw ", + "SafariZo 3440.697N 08700.774W 0000000m Safari Zone by Zaybex ", + "JckDnlsC 3517.077N 08622.260W 0000000m Jack Daniels Cache by Rmearse ", + "FrgttnPr 3509.599N 08633.282W 0000000m Forgotten Park ", + "DntOvrlk 3513.326N 08616.031W 0000000m Dont Overlook Me Cache ", + "ArYStmpd 3513.039N 08615.110W 0000000m Are You Stumped Yet? cache ", + "CchtthBn 3512.532N 08614.691W 0000000m Cache at the Bend ", + "Thtsnkng 3609.009N 08530.314W 0000000m That sinking feeling by Tntcac", + "GamersCc 3449.136N 08635.836W 0000000m mer's Cache by avoral ", + "CchMIfYC 3452.455N 08620.648W 0000000m Cache Me If You Can! by Glen H", + "SavageVs 3526.915N 08535.136W 0000000m Savage Vista by White Dog Pack", + "PrtrnG15 3555.479N 08653.274W 0000000m Praetorian Guards Hail Caesar #15!", + "WtrlnAmp 3443.722N 08632.535W 0000000m Waterline Amphitheater by Fath", + "BysLttlC 3447.569N 08638.448W 0000000m Boys' Little Cache by Zaybex ", + "DrgnsBrt 3443.779N 08635.188W 0000000m Dragon's Breath by Zaybex ", + "CryBbyHl 3430.733N 08657.362W 0000000m Cry Baby Hollow Cache by La Pa", + "Parmer 3606.218N 08651.590W 0000000m Parmer by A182pilot & Family ", + "JnnfrndJ 3438.141N 08632.991W 0000000m Jennifer and Jonathans Cliff C", + "ALDRIDGE 3435.305N 08632.868W 0000000m ALDRIDGE CREEK LOTTA LOOT!! by", + "RcktCtyS 3440.032N 08631.352W 0000000m Rocket City Stash by David Upt", + "TrgcAccd 3608.561N 08648.381W 0000000m Tragic Accident by Campaholics", + "FALLENTR 3439.210N 08631.104W 0000000m FALLEN TREE 4 MILE POST by zac", + "TrshOt15 3558.964N 08646.064W 0000000m Cache In Trash Out # 15 ", + "TrshOt13 3602.214N 08650.428W 0000000m Cache In Trash Out #13 ", + "PrcysDrp 3604.312N 08653.465W 0000000m Percys Dripping Springs by KLi", + "TrshOt14 3605.292N 08648.560W 0000000m Cache In Trash Out # 14 ", + "PrtrnGr5 3557.621N 08640.278W 0000000m Praetorian Guards Hail Caesar #5!", + "PrtrnGr4 3557.370N 08640.201W 0000000m Praetorian Guards Hail Caesar #4!", + "PrtrnGr3 3557.250N 08640.047W 0000000m Praetorian Guards Hail Caesar #3!", + "GrnMntnC 3439.120N 08631.100W 0000000m Green Mountain Cache by Steve ", + "TrshOt12 3605.330N 08635.817W 0000000m Cache In Trash Out #12 ", + "BlncngAc 3608.579N 08648.120W 0000000m Balancing Act by Campaholics ", + "DittoCac 3434.652N 08633.310W 0000000m Ditto Cache by mookey ", + "EraserCc 3431.888N 08633.024W 0000000m Eraser Cache by Zaybex ", + "FrMlPstE 3439.440N 08630.180W 0000000m Four Mile Post Extension Cache", + "MllrdFxC 3439.578N 08706.552W 0000000m Mallard-Fox Creek Cache by bam", + "FireCach 3443.908N 08630.318W 0000000m he by Glen Pam Chase M ", + "FlntRvrC 3443.170N 08625.990W 0000000m Flint River Canoe Cache by Ran", + "ArabinCc 3419.104N 08628.765W 0000000m The Arabian Cache by WesNSpace", + "CvrdBrdg 3412.406N 08659.392W 0000000m Covered Bridge Cache by pmarkh", + "MilesTCc 3424.470N 08611.720W 0000000m Miles Too Cache by Rmearse ", + "MbryOvrl 3423.803N 08611.922W 0000000m Mabrey Overlook Me by DDVaughn", + "LwEnfrcm 3423.218N 08612.258W 0000000m Law Enforcement Cache by DDVau", + "GrndDddy 3423.128N 08612.025W 0000000m Grand Daddys Home by Rmearse ", + "BamaCach 3421.459N 08611.686W 0000000m The Bama Cache by DDVaughn & T", + "Canyons 3440.085N 08600.910W 0000000m The Canyons by Aubrey and Josh", + "ADamGodV 3511.677N 08616.587W 0000000m A Dam Good View by mdawg & muf", + "UNDERTHE 3446.918N 08739.790W 0000000m UNDER THE ROCK by RUNNINGWILD ", + "SQUIRREL 3448.712N 08741.681W 0000000m SQUIRREL'S NEST by RUNNINGWILD", + "WlknthPr 3448.273N 08741.844W 0000000m Walk in the Park by Runningwil", + "NetsClue 3448.494N 08741.977W 0000000m Net's Clues by Runningwild Adv", + "NatrlBrd 3405.583N 08736.909W 0000000m Natural Bridge by Southeast Xt", + "TrnglPrk 3341.448N 08640.980W 0000000m Triangle Park Cache by Charles", + "LttlRvrI 3421.855N 08539.597W 0000000m Little River Initiative by spa", + "GimmShlt 3430.087N 08536.834W 0000000m Gimme Shelter by Big Rock & Po", + "GnomeTrs 3433.081N 08535.849W 0000000m Gnome Treasure by Big Rock ", + "FlyingTr 3608.594N 08648.179W 0000000m Flying Torso by Campaholics ", + "CultivtC 3608.582N 08648.064W 0000000m Cultivate a Cure by Campahol" } ; - extern "C" { - struct short_handle *mkshort_new_handle(void); - char * mkshort (struct short_handle *, char*); - void setshort_whitespace_ok(struct short_handle *, int n); - } +extern "C" { + struct short_handle* mkshort_new_handle(void); + char* mkshort(struct short_handle*, char*); + void setshort_whitespace_ok(struct short_handle*, int n); +} main() { - char **foop = foo; - bool r; - Shortname sn; + char** foop = foo; + bool r; + Shortname sn; // printf("%s\n", qPrintable(sn.Shorten("The Troll"))); #if 0 - printf("%s\n", mkshort("The Troll")); - printf("%s\n", mkshort("EFI")); - printf("%s\n", mkshort("the Troll")); - printf("%s\n", mkshort("the Trolley")); - printf("%s\n", mkshort("The Troll Lives Under The Bridge")); - printf("%s\n", mkshort("The \"Troll\" Lives Under $$ The Bridge!")); - printf("%s\n", mkshort("The Trolley Goes Round")); - printf("%s\n", mkshort("Cache In / Trash Out #1")); - printf("%s\n", mkshort("Cache In / Trash Out #2")); - printf("%s\n", mkshort("Cache In / Trash Out #137")); + printf("%s\n", mkshort("The Troll")); + printf("%s\n", mkshort("EFI")); + printf("%s\n", mkshort("the Troll")); + printf("%s\n", mkshort("the Trolley")); + printf("%s\n", mkshort("The Troll Lives Under The Bridge")); + printf("%s\n", mkshort("The \"Troll\" Lives Under $$ The Bridge!")); + printf("%s\n", mkshort("The Trolley Goes Round")); + printf("%s\n", mkshort("Cache In / Trash Out #1")); + printf("%s\n", mkshort("Cache In / Trash Out #2")); + printf("%s\n", mkshort("Cache In / Trash Out #137")); #endif #if 1 - struct short_handle *mh = mkshort_new_handle(); - setshort_whitespace_ok(mh, 0); + struct short_handle* mh = mkshort_new_handle(); + setshort_whitespace_ok(mh, 0); - sn.target_length(8); - sn.whitespace_ok(false); + sn.target_length(8); + sn.whitespace_ok(false); - while (*foop) { + while (*foop) { // printf("%s %s\n", mkshort(*foop+39), *foop+39); - QString s = sn.Shorten(*foop + 39); - QString r = (*foop); - r.truncate(8); + QString s = sn.Shorten(*foop + 39); + QString r = (*foop); + r.truncate(8); //fprintf(stderr, "zzz%s\n", *foop + 39); - char *os = mkshort (mh, *foop + 39); -if (s != os) { - fprintf(stderr, "%s/%s\n", qPrintable(r), os); -} - // assert(r == s); - foop++; - } + char* os = mkshort(mh, *foop + 39); + if (s != os) { + fprintf(stderr, "%s/%s\n", qPrintable(r), os); + } + // assert(r == s); + foop++; + } #endif #define X(a,b) assert(a == sn.Shorten(b)); X("GC12345", "GC12345"); @@ -364,18 +368,18 @@ if (s != os) { X("eat a pc", "eat a peach"); X("eat a or", "eat a orange"); - printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a peach", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a orange", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a peach", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a orange", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "the quick brown foo", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "the quick brown fox", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "eat a peach", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a peach", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a orange", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "xxx", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "ixxx", r))); -printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "aexxx", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "the quick brown foo", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "the quick brown fox", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "eat a peach", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a peach", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(5, "eat a orange", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "xxx", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "ixxx", r))); + printf("%s\n", qPrintable(Shortname::DeleteLastVowel(0, "aexxx", r))); } #endif diff --git a/gpsbabel/skyforce.cc b/gpsbabel/skyforce.cc index 0281ec99d..9c447d5e3 100644 --- a/gpsbabel/skyforce.cc +++ b/gpsbabel/skyforce.cc @@ -36,16 +36,16 @@ arglist_t skyforce_args[] = { ARG_TERMINATOR }; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int rte_num, wpt_num; static short_handle short_h; -static const waypoint *prev_wpt; +static const waypoint* prev_wpt; -static waypoint * -skyforce_parse_coords(const char *str) +static waypoint* +skyforce_parse_coords(const char* str) { - waypoint *wpt; + waypoint* wpt; if (strlen(str) < 38) { fatal(MYNAME ": Incomplete line!\n"); @@ -69,10 +69,10 @@ skyforce_parse_coords(const char *str) } -static waypoint * -skyforce_parse_wpt(const char *str, int *rte_num) +static waypoint* +skyforce_parse_wpt(const char* str, int* rte_num) { - waypoint *wpt; + waypoint* wpt; wpt = skyforce_parse_coords(str); if (wpt == NULL) { @@ -89,15 +89,15 @@ skyforce_parse_wpt(const char *str, int *rte_num) } -static waypoint * -skyforce_parse_trk(const char *str) +static waypoint* +skyforce_parse_trk(const char* str) { - char *cx; + char* cx; struct tm tm; char buf[15]; int len; - waypoint *wpt; + waypoint* wpt; wpt = skyforce_parse_coords(str); if (wpt == NULL) { @@ -132,7 +132,7 @@ skyforce_parse_trk(const char *str) static void -skyforce_head_disp_cb(const route_head *head) +skyforce_head_disp_cb(const route_head* head) { prev_wpt = NULL; if (head->rte_waypt_ct <= 0) { @@ -152,7 +152,7 @@ skyforce_head_disp_cb(const route_head *head) static void -skyforce_waypt_disp_cb(const waypoint *wpt) +skyforce_waypt_disp_cb(const waypoint* wpt) { char buf[75]; /* long enough for all data types */ double lat, lon; @@ -181,7 +181,7 @@ skyforce_waypt_disp_cb(const waypoint *wpt) tm = *gmtime(&tt); strftime(buf + 2, sizeof(buf) - 2, "%d%m%y %H%M%S ", &tm); } else { - char *name; + char* name; if (rte_num > 999) { return; @@ -241,7 +241,7 @@ skyforce_waypt_disp_cb(const waypoint *wpt) *******************************************************************************/ static void -skyforce_rd_init(const char *fname) +skyforce_rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); } @@ -257,8 +257,8 @@ skyforce_rd_deinit(void) static void skyforce_read(void) { - char *str; - route_head *rte, *trk; + char* str; + route_head* rte, *trk; wpt_num = 0; rte = trk = NULL; @@ -266,7 +266,7 @@ skyforce_read(void) while ((str = gbfgetstr(fin))) { - waypoint *wpt; + waypoint* wpt; int i; str = lrtrim(str); @@ -323,7 +323,7 @@ skyforce_read(void) static void -skyforce_wr_init(const char *fname) +skyforce_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); diff --git a/gpsbabel/skytraq.cc b/gpsbabel/skytraq.cc index dcd7242c2..d7de4b950 100644 --- a/gpsbabel/skytraq.cc +++ b/gpsbabel/skytraq.cc @@ -53,21 +53,21 @@ #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) -static char *port; /* port name */ -static void *serial_handle = 0; /* IO file descriptor */ +static char* port; /* port name */ +static void* serial_handle = 0; /* IO file descriptor */ static int skytraq_baud = 0; /* detected baud rate */ -static gbfile *file_handle = 0; /* file descriptor (used by skytraq-bin format) */ - -static char *opt_erase = 0; /* erase after read? (0/1) */ -static char *opt_initbaud = 0; /* baud rate used to init device */ -static char *opt_dlbaud = 0; /* baud rate used for downloading tracks */ -static char *opt_read_at_once = 0; /* number of sectors to read at once (Venus6 only) */ -static char *opt_first_sector = 0; /* first sector to be read from the device (default: 0) */ -static char *opt_last_sector = 0; /* last sector to be read from the device (default: smart read everything) */ -static char *opt_dump_file = 0; /* dump raw data to this file (optional) */ -static char *opt_no_output = 0; /* disable output? (0/1) */ -static char *opt_set_location = 0; /* set if the "targetlocation" options was used */ -static char *opt_configure_logging = 0; +static gbfile* file_handle = 0; /* file descriptor (used by skytraq-bin format) */ + +static char* opt_erase = 0; /* erase after read? (0/1) */ +static char* opt_initbaud = 0; /* baud rate used to init device */ +static char* opt_dlbaud = 0; /* baud rate used for downloading tracks */ +static char* opt_read_at_once = 0; /* number of sectors to read at once (Venus6 only) */ +static char* opt_first_sector = 0; /* first sector to be read from the device (default: 0) */ +static char* opt_last_sector = 0; /* last sector to be read from the device (default: smart read everything) */ +static char* opt_dump_file = 0; /* dump raw data to this file (optional) */ +static char* opt_no_output = 0; /* disable output? (0/1) */ +static char* opt_set_location = 0; /* set if the "targetlocation" options was used */ +static char* opt_configure_logging = 0; static arglist_t skytraq_args[] = { @@ -128,7 +128,7 @@ arglist_t skytraq_fargs[] = { }; static void -db(int l, const char *msg, ...) +db(int l, const char* msg, ...) { va_list ap; va_start(ap, msg); @@ -147,7 +147,7 @@ rd_drain(void) } static int -rd_char(int *errors) +rd_char(int* errors) { int c; while (*errors > 0) { @@ -165,7 +165,7 @@ rd_char(int *errors) } static int -rd_buf(const uint8_t *buf, int len) +rd_buf(const uint8_t* buf, int len) { int rc, timeout, i; char dump[16*3+16+2]; @@ -235,7 +235,7 @@ wr_char(int c) } static void -wr_buf(const unsigned char *str, int len) +wr_buf(const unsigned char* str, int len) { int i; for (i = 0; i < len; i++) { @@ -252,7 +252,7 @@ uint8_t MSG_START[2] = { 0xA0, 0xA1 }; uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' }; static int -skytraq_calc_checksum(const unsigned char *buf, int len) +skytraq_calc_checksum(const unsigned char* buf, int len) { int i, cs = 0; for (i = 0; i < len; i++) { @@ -262,7 +262,7 @@ skytraq_calc_checksum(const unsigned char *buf, int len) } static int -skytraq_rd_msg(const void *payload, unsigned int len) +skytraq_rd_msg(const void* payload, unsigned int len) { int errors = 5; /* allow this many errors */ unsigned int c, i, state; @@ -315,7 +315,7 @@ skytraq_rd_msg(const void *payload, unsigned int len) } static void -skytraq_wr_msg(const uint8_t *payload, int len) +skytraq_wr_msg(const uint8_t* payload, int len) { int cs; @@ -371,7 +371,7 @@ skytraq_expect_ack(uint8_t id) } static int -skytraq_expect_msg(uint8_t id, const uint8_t *payload, int len) +skytraq_expect_msg(uint8_t id, const uint8_t* payload, int len) { int i, rc; @@ -389,7 +389,7 @@ skytraq_expect_msg(uint8_t id, const uint8_t *payload, int len) } static int -skytraq_wr_msg_verify(const uint8_t *payload, int len) +skytraq_wr_msg_verify(const uint8_t* payload, int len) { int i, rc; @@ -478,42 +478,42 @@ skytraq_set_baud(int baud) static int skytraq_configure_logging(void) { - // an0008-1.4.14: logs if - // (dt > tmin & dd >= dmin & v >= vmin) | dt > tmax | dd > dmax | v > vmax - unsigned int tmin=6, tmax=3600, dmin=0, dmax=10000, nn=0; - uint8_t MSG_LOG_CONFIGURE_CONTROL[] = { - 0x18, // message_id - 0x00, 0x00, 0x0e, 0x10, // max_time: was 0x0000ffff (big endian!) - 0x00, 0x00, 0x00, 0x06, // min_time: was 0x00000005 - 0x00, 0x00, 0x27, 0x10, // max_distance: was 0x0000ffff - 0x00, 0x00, 0x00, 0x00, // min_distance - 0x00, 0x00, 0xff, 0xff, // max_speed - 0x00, 0x00, 0x00, 0x00, // min_speed - 0x01, // datalog_enable: NOTE: always ON - 0x00 // reserved - }; - - if(opt_configure_logging) { - if(*opt_configure_logging) { - nn = sscanf(opt_configure_logging, "%u:%u:%u:%u", &tmin, &tmax, &dmin, &dmax); - if(nn>3) { - db(0, "Reconfiguring logging to: tmin=%u, tmax=%u, dmin=%u, dmax=%u\n", tmin, tmax, dmin, dmax ); - be_write32(MSG_LOG_CONFIGURE_CONTROL+5, tmin); - be_write32(MSG_LOG_CONFIGURE_CONTROL+1, tmax); - be_write32(MSG_LOG_CONFIGURE_CONTROL+13, dmin); - be_write32(MSG_LOG_CONFIGURE_CONTROL+9, dmax); - } else { - db(1, MYNAME "Option usage: configlog=tmin:tmax:dmin:dmax"); - return -1; - } + // an0008-1.4.14: logs if + // (dt > tmin & dd >= dmin & v >= vmin) | dt > tmax | dd > dmax | v > vmax + unsigned int tmin=6, tmax=3600, dmin=0, dmax=10000, nn=0; + uint8_t MSG_LOG_CONFIGURE_CONTROL[] = { + 0x18, // message_id + 0x00, 0x00, 0x0e, 0x10, // max_time: was 0x0000ffff (big endian!) + 0x00, 0x00, 0x00, 0x06, // min_time: was 0x00000005 + 0x00, 0x00, 0x27, 0x10, // max_distance: was 0x0000ffff + 0x00, 0x00, 0x00, 0x00, // min_distance + 0x00, 0x00, 0xff, 0xff, // max_speed + 0x00, 0x00, 0x00, 0x00, // min_speed + 0x01, // datalog_enable: NOTE: always ON + 0x00 // reserved + }; + + if (opt_configure_logging) { + if (*opt_configure_logging) { + nn = sscanf(opt_configure_logging, "%u:%u:%u:%u", &tmin, &tmax, &dmin, &dmax); + if (nn>3) { + db(0, "Reconfiguring logging to: tmin=%u, tmax=%u, dmin=%u, dmax=%u\n", tmin, tmax, dmin, dmax); + be_write32(MSG_LOG_CONFIGURE_CONTROL+5, tmin); + be_write32(MSG_LOG_CONFIGURE_CONTROL+1, tmax); + be_write32(MSG_LOG_CONFIGURE_CONTROL+13, dmin); + be_write32(MSG_LOG_CONFIGURE_CONTROL+9, dmax); + } else { + db(1, MYNAME "Option usage: configlog=tmin:tmax:dmin:dmax"); + return -1; } - } + } + } - return skytraq_wr_msg_verify(MSG_LOG_CONFIGURE_CONTROL, sizeof(MSG_LOG_CONFIGURE_CONTROL)); + return skytraq_wr_msg_verify(MSG_LOG_CONFIGURE_CONTROL, sizeof(MSG_LOG_CONFIGURE_CONTROL)); } static int -skytraq_get_log_buffer_status(uint32_t *log_wr_ptr, uint16_t *sectors_free, uint16_t *sectors_total) +skytraq_get_log_buffer_status(uint32_t* log_wr_ptr, uint16_t* sectors_free, uint16_t* sectors_total) { uint8_t MSG_LOG_STATUS_CONTROL = 0x17; struct { @@ -560,7 +560,7 @@ skytraq_get_log_buffer_status(uint32_t *log_wr_ptr, uint16_t *sectors_free, uint } /* reads 32-bit "middle-endian" fields */ -static unsigned int me_read32(const unsigned char *p) +static unsigned int me_read32(const unsigned char* p) { return ((unsigned)be_read16(p+2) << 16) | ((unsigned)be_read16(p)); } @@ -587,18 +587,21 @@ gpstime_to_timet(int week, int sec) /* leap second compensation: */ gps_timet -= 13; /* diff GPS-UTC=13s (valid from Jan 01 1999 on) */ - if (gps_timet >= 1136073600) /* Jan 01 2006 0:00 UTC */ - gps_timet--; /* GPS-UTC = 14s */ - if (gps_timet >= 1230768000) /* Jan 01 2009 0:00 UTC */ - gps_timet--; /* GPS-UTC = 15s */ - if (gps_timet >= 1341100800) /* Jul 01 2012 0:00 UTC */ - gps_timet--; /* GPS-UTC = 16s */ + if (gps_timet >= 1136073600) { /* Jan 01 2006 0:00 UTC */ + gps_timet--; /* GPS-UTC = 14s */ + } + if (gps_timet >= 1230768000) { /* Jan 01 2009 0:00 UTC */ + gps_timet--; /* GPS-UTC = 15s */ + } + if (gps_timet >= 1341100800) { /* Jul 01 2012 0:00 UTC */ + gps_timet--; /* GPS-UTC = 16s */ + } return gps_timet; /* returns UTC time */ } static void -ECEF_to_LLA(double x, double y, long z, double *lat, double *lon, double *alt) +ECEF_to_LLA(double x, double y, long z, double* lat, double* lon, double* alt) { /* constants: */ const double CA = 6378137.0; @@ -624,7 +627,7 @@ ECEF_to_LLA(double x, double y, long z, double *lat, double *lon, double *alt) } struct read_state { - route_head *route_head_; + route_head* route_head_; unsigned wpn, tpn; unsigned gps_week; @@ -633,9 +636,9 @@ struct read_state { }; static void -state_init(struct read_state *pst) +state_init(struct read_state* pst) { - route_head *track; + route_head* track; track = route_head_alloc(); track->rte_name = xstrdup("SkyTraq tracklog"); @@ -653,10 +656,10 @@ state_init(struct read_state *pst) pst->z = 0; } -static waypoint * -make_trackpoint(struct read_state *st, double lat, double lon, double alt) +static waypoint* +make_trackpoint(struct read_state* st, double lat, double lon, double alt) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); xasprintf(&wpt->shortname, "TP%04d", ++st->tpn); @@ -706,7 +709,7 @@ typedef struct { #define ITEM_SPEED(item) (item->type_and_speed[1] | ((item->type_and_speed[0] & 0x0F) << 8)) static int -process_data_item(struct read_state *pst, const item_frame *pitem, int len) +process_data_item(struct read_state* pst, const item_frame* pitem, int len) { int res = 0; double lat, lon, alt; @@ -714,7 +717,7 @@ process_data_item(struct read_state *pst, const item_frame *pitem, int len) int poi = 0; full_item f; compact_item c; - waypoint *tpt = NULL; + waypoint* tpt = NULL; switch (ITEM_TYPE(pitem)) { case 0x6: /* POI item (same structure as full) */ @@ -807,7 +810,7 @@ process_data_item(struct read_state *pst, const item_frame *pitem, int len) } static int /* returns number of bytes processed (terminates on 0xFF i.e. empty or padding bytes) */ -process_data_sector(struct read_state *pst, const uint8_t *buf, int len) +process_data_sector(struct read_state* pst, const uint8_t* buf, int len) { int plen, ilen; @@ -824,7 +827,7 @@ process_data_sector(struct read_state *pst, const uint8_t *buf, int len) /* Note: the buffer is being padded with 0xFFs if necessary so there are always SECTOR_SIZE valid bytes */ static int -skytraq_read_single_sector(unsigned int sector, uint8_t *buf) +skytraq_read_single_sector(unsigned int sector, uint8_t* buf) { uint8_t MSG_LOG_SECTOR_READ_CONTROL[2] = { 0x1B, (uint8_t)(sector) }; int errors = 5; /* allow this many errors */ @@ -915,10 +918,10 @@ skytraq_read_single_sector(unsigned int sector, uint8_t *buf) } static int -skytraq_read_multiple_sectors(int first_sector, unsigned int sector_count, uint8_t *buf) +skytraq_read_multiple_sectors(int first_sector, unsigned int sector_count, uint8_t* buf) { uint8_t MSG_LOG_READ_MULTI_SECTORS[5] = { 0x1D }; - uint8_t *buf_end_tag; + uint8_t* buf_end_tag; unsigned int cs, i, read_result; if (first_sector < 0 || first_sector > 0xFFFF) { @@ -974,8 +977,8 @@ skytraq_read_tracks(void) int opt_first_sector_val = atoi(opt_first_sector); int opt_last_sector_val = atoi(opt_last_sector); int multi_read_supported = 1; - uint8_t *buffer = NULL; - gbfile *dumpfile = NULL; + uint8_t* buffer = NULL; + gbfile* dumpfile = NULL; state_init(&st); @@ -1215,7 +1218,7 @@ skytraq_set_location(void) *******************************************************************************/ static void -skytraq_rd_init(const char *fname) +skytraq_rd_init(const char* fname) { port = xstrdup(fname); if ((serial_handle = gbser_init(fname)) == NULL) { @@ -1244,9 +1247,9 @@ skytraq_read(void) return; } - if(*opt_configure_logging) { - skytraq_configure_logging(); - return; + if (*opt_configure_logging) { + skytraq_configure_logging(); + return; } dlbaud = atoi(opt_dlbaud); @@ -1270,7 +1273,7 @@ skytraq_read(void) } static void -file_init(const char *fname) +file_init(const char* fname) { db(1, "Opening file...\n"); if ((file_handle = gbfopen(fname, "rb", MYNAME)) == NULL) { @@ -1294,7 +1297,7 @@ file_read(void) int opt_first_sector_val = atoi(opt_first_sector); int opt_last_sector_val = atoi(opt_last_sector); int sectors_read; - uint8_t *buffer; + uint8_t* buffer; state_init(&st); buffer = (uint8_t*) xmalloc(SECTOR_SIZE); @@ -1372,11 +1375,11 @@ ff_vecs_t skytraq_fvecs = { #undef MYNAME #endif #define MYNAME "miniHomer" -static char *opt_set_poi_home = NULL; /* set if a "poi" option was used */ -static char *opt_set_poi_car = NULL; /* set if a "poi" option was used */ -static char *opt_set_poi_boat = NULL; /* set if a "poi" option was used */ -static char *opt_set_poi_heart = NULL; /* set if a "poi" option was used */ -static char *opt_set_poi_bar = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_home = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_car = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_boat = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_heart = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_bar = NULL; /* set if a "poi" option was used */ arglist_t miniHomer_args[] = { { "baud", &opt_dlbaud, "Baud rate used for download", "115200", ARGTYPE_INT, "0", "115200" }, { "dump-file", &opt_dump_file, "Dump raw data to this file", NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX }, @@ -1396,11 +1399,11 @@ arglist_t miniHomer_args[] = { /* * Names of the POIs on miniHomer */ -static const char *poinames[] = { +static const char* poinames[] = { "Home", "Car", "Boat", "Heart", "Bar" }; #define NUMPOI (sizeof poinames/sizeof poinames[0]) -int getPoiByName(char *name) +int getPoiByName(char* name) { unsigned int i; for (i=0; i>8)&0xff; @@ -1479,7 +1482,7 @@ static void miniHomer_get_poi() * -1 in case of errors * the number of the POI will not be checked - if it is not correct, miniHome will send NACK */ -static int miniHomer_set_poi(uint16_t poinum, const char *opt_poi) +static int miniHomer_set_poi(uint16_t poinum, const char* opt_poi) { #define MSG_SET_POI_SIZE (sizeof(uint8_t)+sizeof(uint16_t)+3*sizeof(double)+sizeof(uint8_t)) uint8_t MSG_SET_POI[MSG_SET_POI_SIZE] = { @@ -1526,9 +1529,9 @@ static int miniHomer_set_poi(uint16_t poinum, const char *opt_poi) } return result; } -static const char *mhport; +static const char* mhport; static void -miniHomer_rd_init(const char *fname) +miniHomer_rd_init(const char* fname) { opt_set_location=""; // otherwise it will lead to bus error skytraq_rd_init(fname); // sets global var serial_handle diff --git a/gpsbabel/smplrout.cc b/gpsbabel/smplrout.cc index 9b25d336f..4ade18264 100644 --- a/gpsbabel/smplrout.cc +++ b/gpsbabel/smplrout.cc @@ -68,12 +68,12 @@ static int count = 0; static double totalerror = 0; static double error = 0; -static char *countopt; -static char *erroropt; -static char *xteopt; -static char *lenopt; -static char *relopt; -void (*waypt_del_fnp)(route_head *rte, waypoint *wpt); +static char* countopt; +static char* erroropt; +static char* xteopt; +static char* lenopt; +static char* relopt; +void (*waypt_del_fnp)(route_head* rte, waypoint* wpt); static arglist_t routesimple_args[] = { @@ -105,37 +105,37 @@ struct xte_intermed; struct xte { double distance; int ordinal; - struct xte_intermed *intermed; + struct xte_intermed* intermed; }; struct xte_intermed { - struct xte *xte_rec; - struct xte_intermed *next; - struct xte_intermed *prev; - const waypoint *wpt; + struct xte* xte_rec; + struct xte_intermed* next; + struct xte_intermed* prev; + const waypoint* wpt; }; void -free_xte(struct xte *xte_rec) +free_xte(struct xte* xte_rec) { xfree(xte_rec->intermed); } #define HUGEVAL 2000000000 -static struct xte_intermed *tmpprev = NULL; +static struct xte_intermed* tmpprev = NULL; static int xte_count = 0; -static const route_head *cur_rte = NULL; -static struct xte *xte_recs = NULL; +static const route_head* cur_rte = NULL; +static struct xte* xte_recs = NULL; void -routesimple_waypt_pr(const waypoint *wpt) +routesimple_waypt_pr(const waypoint* wpt) { if (!cur_rte) { return; } xte_recs[xte_count].ordinal=xte_count; - xte_recs[xte_count].intermed = (struct xte_intermed *) xmalloc(sizeof(struct xte_intermed)); + xte_recs[xte_count].intermed = (struct xte_intermed*) xmalloc(sizeof(struct xte_intermed)); xte_recs[xte_count].intermed->wpt = wpt; xte_recs[xte_count].intermed->xte_rec = xte_recs+xte_count; xte_recs[xte_count].intermed->next = NULL; @@ -148,11 +148,11 @@ routesimple_waypt_pr(const waypoint *wpt) } void -compute_xte(struct xte *xte_rec) +compute_xte(struct xte* xte_rec) { - const waypoint *wpt3 = xte_rec->intermed->wpt; - const waypoint *wpt1 = NULL; - const waypoint *wpt2 = NULL; + const waypoint* wpt3 = xte_rec->intermed->wpt; + const waypoint* wpt1 = NULL; + const waypoint* wpt2 = NULL; double frac, reslat, reslon; /* if no previous, this is an endpoint and must be preserved. */ if (!xte_rec->intermed->prev) { @@ -210,18 +210,18 @@ compute_xte(struct xte *xte_rec) int -compare_xte(const void *a, const void *b) +compare_xte(const void* a, const void* b) { - double distdiff = ((struct xte *)a)->distance - - ((struct xte *)b)->distance; - int priodiff = ((struct xte *)a)->intermed->wpt->route_priority - - ((struct xte *)b)->intermed->wpt->route_priority; + double distdiff = ((struct xte*)a)->distance - + ((struct xte*)b)->distance; + int priodiff = ((struct xte*)a)->intermed->wpt->route_priority - + ((struct xte*)b)->intermed->wpt->route_priority; - if (HUGEVAL == ((struct xte *)a)->distance) { + if (HUGEVAL == ((struct xte*)a)->distance) { return -1; } - if (HUGEVAL == ((struct xte *)b)->distance) { + if (HUGEVAL == ((struct xte*)b)->distance) { return 1; } @@ -241,7 +241,7 @@ compare_xte(const void *a, const void *b) } void -routesimple_head(const route_head *rte) +routesimple_head(const route_head* rte) { cur_rte = NULL; /* build array of XTE/wpt xref records */ @@ -259,13 +259,13 @@ routesimple_head(const route_head *rte) return; } - xte_recs = (struct xte *) xcalloc(rte->rte_waypt_ct, sizeof(struct xte)); + xte_recs = (struct xte*) xcalloc(rte->rte_waypt_ct, sizeof(struct xte)); cur_rte = rte; } void -shuffle_xte(struct xte *xte_rec) +shuffle_xte(struct xte* xte_rec) { struct xte tmp_xte; while (xte_rec > xte_recs && compare_xte(xte_rec, xte_rec-1) < 0) { @@ -300,7 +300,7 @@ shuffle_xte(struct xte *xte_rec) } void -routesimple_tail(const route_head *rte) +routesimple_tail(const route_head* rte) { int i; if (!cur_rte) { @@ -335,9 +335,9 @@ routesimple_tail(const route_head *rte) totalerror += xte_recs[i].distance; } } - (*waypt_del_fnp)((route_head *)(void *)rte, - (waypoint *)(void *)(xte_recs[i].intermed->wpt)); - waypt_free((waypoint *)(void *)(xte_recs[i].intermed->wpt)); + (*waypt_del_fnp)((route_head*)(void*)rte, + (waypoint*)(void*)(xte_recs[i].intermed->wpt)); + waypt_free((waypoint*)(void*)(xte_recs[i].intermed->wpt)); if (xte_recs[i].intermed->prev) { xte_recs[i].intermed->prev->next = xte_recs[i].intermed->next; @@ -373,7 +373,7 @@ routesimple_process(void) } void -routesimple_init(const char *args) +routesimple_init(const char* args) { count = 0; @@ -384,7 +384,7 @@ routesimple_init(const char *args) fatal(MYNAME ": You may specify only one of crosstrack, length, or relative.\n"); } if (!xteopt && !lenopt && !relopt) { - xteopt = (char *) ""; + xteopt = (char*) ""; } if (countopt) { diff --git a/gpsbabel/sort.cc b/gpsbabel/sort.cc index dec8a74cd..e670ddf21 100644 --- a/gpsbabel/sort.cc +++ b/gpsbabel/sort.cc @@ -33,7 +33,7 @@ typedef enum { sort_mode_ sort_mode = sm_shortname; /* How are we sorting these? */ -static char *opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time; +static char* opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time; static arglist_t sort_args[] = { @@ -57,10 +57,10 @@ arglist_t sort_args[] = { }; static int -sort_comp(const queue * a, const queue * b) +sort_comp(const queue* a, const queue* b) { - const waypoint *x1 = (waypoint *)a; - const waypoint *x2 = (waypoint *)b; + const waypoint* x1 = (waypoint*)a; + const waypoint* x2 = (waypoint*)b; switch (sort_mode) { case sm_gcid: @@ -84,7 +84,7 @@ sort_process(void) } void -sort_init(const char *args) +sort_init(const char* args) { if (opt_sm_gcid) { sort_mode = sm_gcid; diff --git a/gpsbabel/stackfilter.cc b/gpsbabel/stackfilter.cc index 826a71456..11a66e9ee 100644 --- a/gpsbabel/stackfilter.cc +++ b/gpsbabel/stackfilter.cc @@ -26,15 +26,15 @@ #define MYNAME "Stack filter" -static char *opt_push = NULL; -static char *opt_copy = NULL; -static char *opt_pop = NULL; -static char *opt_append = NULL; -static char *opt_discard = NULL; -static char *opt_replace = NULL; -static char *opt_swap = NULL; -static char *opt_depth = NULL; -static char *nowarn = NULL; +static char* opt_push = NULL; +static char* opt_copy = NULL; +static char* opt_pop = NULL; +static char* opt_append = NULL; +static char* opt_discard = NULL; +static char* opt_replace = NULL; +static char* opt_swap = NULL; +static char* opt_depth = NULL; +static char* nowarn = NULL; static int warnings_enabled = 1; static int swapdepth = 0; @@ -86,21 +86,21 @@ struct stack_elt { unsigned int waypt_ct; int route_count; int track_count; - struct stack_elt *next; -} *stack = NULL; + struct stack_elt* next; +}* stack = NULL; void stackfilt_process(void) { - struct stack_elt *tmp_elt = NULL; - queue *elem = NULL; - queue *tmp = NULL; + struct stack_elt* tmp_elt = NULL; + queue* elem = NULL; + queue* tmp = NULL; queue tmp_queue; unsigned int tmp_count; if (opt_push) { - tmp_elt = (struct stack_elt *)xmalloc(sizeof(struct stack_elt)); + tmp_elt = (struct stack_elt*)xmalloc(sizeof(struct stack_elt)); QUEUE_MOVE(&(tmp_elt->waypts), &waypt_head); tmp_elt->waypt_ct = waypt_count(); @@ -109,7 +109,7 @@ stackfilt_process(void) stack = tmp_elt; if (opt_copy) { QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) { - waypt_add(waypt_dupe((waypoint *)elem)); + waypt_add(waypt_dupe((waypoint*)elem)); } } @@ -136,7 +136,7 @@ stackfilt_process(void) } if (opt_append) { QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) { - waypt_add((waypoint *)elem); + waypt_add((waypoint*)elem); } route_append(&(stack->routes)); route_flush(&(stack->routes)); @@ -191,7 +191,7 @@ stackfilt_process(void) } void -stackfilt_init(const char *args) +stackfilt_init(const char* args) { int invalid = 0; @@ -239,7 +239,7 @@ stackfilt_deinit(void) void stackfilt_exit(void) { - struct stack_elt *tmp_elt = NULL; + struct stack_elt* tmp_elt = NULL; if (warnings_enabled && stack) { warning(MYNAME " Warning: leftover stack entries; " diff --git a/gpsbabel/stmsdf.cc b/gpsbabel/stmsdf.cc index d5a14dcae..cff4241c2 100644 --- a/gpsbabel/stmsdf.cc +++ b/gpsbabel/stmsdf.cc @@ -54,18 +54,18 @@ typedef enum { sdf_custom } sdf_section_e; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int lineno; static int datum; static int filetype; -static route_head *route; +static route_head* route; static queue trackpts; -static char *rte_name; -static char *rte_desc; +static char* rte_name; +static char* rte_desc; -static waypoint *trkpt_out; -static route_head *trk_out; +static waypoint* trkpt_out; +static route_head* trk_out; static double trkpt_dist; static double minalt, maxalt, maxspeed; @@ -91,7 +91,7 @@ static short_handle short_h; /* placeholders for options */ -static char *opt_route_index; +static char* opt_route_index; static int opt_route_index_value; static @@ -107,11 +107,11 @@ arglist_t stmsdf_args[] = { /* ----------------------------------------------------------- */ static void -parse_header(char *line) +parse_header(char* line) { - char *str; - char *key = NULL; - const char *prod = NULL; + char* str; + char* key = NULL; + const char* prod = NULL; int column = -1; while ((str = csv_lineparse(line, "=", "", lineno))) { @@ -164,10 +164,10 @@ parse_header(char *line) } static int -track_qsort_cb(const void *a, const void *b) +track_qsort_cb(const void* a, const void* b) { - const waypoint *wa = *(waypoint **)a; - const waypoint *wb = *(waypoint **)b; + const waypoint* wa = *(waypoint**)a; + const waypoint* wb = *(waypoint**)b; return wa->GetCreationTime().toTime_t() - wb->GetCreationTime().toTime_t(); } @@ -175,11 +175,11 @@ track_qsort_cb(const void *a, const void *b) static void finalize_tracks(void) { - waypoint **list; + waypoint** list; int count = 0; - queue *elem, *tmp; + queue* elem, *tmp; int index; - route_head *track = NULL; + route_head* track = NULL; int trackno = 0; count = 0; @@ -194,7 +194,7 @@ finalize_tracks(void) index = 0; QUEUE_FOR_EACH(&trackpts, elem, tmp) { - list[index] = (waypoint *)elem; + list[index] = (waypoint*)elem; dequeue(elem); index++; } @@ -202,7 +202,7 @@ finalize_tracks(void) qsort(list, count, sizeof(*list), track_qsort_cb); for (index = 0; index < count; index++) { - waypoint *wpt = list[index]; + waypoint* wpt = list[index]; if (wpt->wpt_flags.fmt_use == 2) { /* log continued */ track = NULL; } @@ -232,13 +232,13 @@ finalize_tracks(void) } static void -parse_point(char *line) +parse_point(char* line) { - char *str; + char* str; int column = -1; int what = -1; /* -1 = unknown, 0 = tp, 1 = mp, 2 = wp, 3 = ap */ - waypoint *wpt = NULL; - char *cx; + waypoint* wpt = NULL; + char* cx; int hour, min, sec, day, month, year; year = hour = -1; @@ -358,7 +358,7 @@ parse_point(char *line) /* ----------------------------------------------------------- */ static void -rd_init(const char *fname) +rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); @@ -386,11 +386,11 @@ rd_deinit(void) static void data_read(void) { - char *buf; + char* buf; sdf_section_e section = sdf_unknown; while ((buf = gbfgetstr(fin))) { - char *cin = lrtrim(buf); + char* cin = lrtrim(buf); if ((lineno++ == 0) && fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); } @@ -400,7 +400,7 @@ data_read(void) } if (*cin == '[') { - char *cend = strchr(++cin, ']'); + char* cend = strchr(++cin, ']'); if (cend != NULL) { *cend = '\0'; @@ -437,8 +437,8 @@ data_read(void) static void -calculate(const waypoint *wpt, double *dist, double *speed, double *course, - double *asc, double *desc) +calculate(const waypoint* wpt, double* dist, double* speed, double* course, + double* asc, double* desc) { if (trkpt_out != NULL) { @@ -493,7 +493,7 @@ calculate(const waypoint *wpt, double *dist, double *speed, double *course, /* pre-calculation callbacks */ static void -any_hdr_calc_cb(const route_head *trk) +any_hdr_calc_cb(const route_head* trk) { trkpt_out = NULL; @@ -512,11 +512,11 @@ any_hdr_calc_cb(const route_head *trk) rte_desc = trk->rte_desc; } - trk_out = (route_head *)trk; + trk_out = (route_head*)trk; } static void -any_waypt_calc_cb(const waypoint *wpt) +any_waypt_calc_cb(const waypoint* wpt) { double speed, course, dist; @@ -547,11 +547,11 @@ any_waypt_calc_cb(const waypoint *wpt) this_time += (wpt->GetCreationTime().toTime_t() - trkpt_out->GetCreationTime().toTime_t()); } - trkpt_out = (waypoint *)wpt; + trkpt_out = (waypoint*)wpt; } static void -any_tlr_calc_cb(const route_head *trk) +any_tlr_calc_cb(const route_head* trk) { if (! this_valid) { return; @@ -565,17 +565,17 @@ any_tlr_calc_cb(const route_head *trk) /* write callbacks */ static void -track_disp_hdr_cb(const route_head *trk) +track_disp_hdr_cb(const route_head* trk) { track_index++; track_points = 0; - trk_out = (route_head *)trk; + trk_out = (route_head*)trk; trkpt_out = NULL; } static void -track_disp_wpt_cb(const waypoint *wpt) +track_disp_wpt_cb(const waypoint* wpt) { struct tm tm; char tbuf[32]; @@ -603,13 +603,13 @@ track_disp_wpt_cb(const waypoint *wpt) } if (flag == 1) { - const char *name = wpt->shortname; + const char* name = wpt->shortname; if (name == NULL) { name = "Log paused"; } gbfprintf(fout, "\"MP\",\"%s\"", name); } else if (flag == 2) { - const char *name = wpt->shortname; + const char* name = wpt->shortname; if (name == NULL) { name = "Log continued"; } @@ -633,27 +633,27 @@ track_disp_wpt_cb(const waypoint *wpt) gbfprintf(fout, ",0\n"); } - trkpt_out = (waypoint *)wpt; + trkpt_out = (waypoint*)wpt; } static void -track_disp_tlr_cb(const route_head *rte) +track_disp_tlr_cb(const route_head* rte) { trkpt_out = NULL; } static void -route_disp_hdr_cb(const route_head *rte) +route_disp_hdr_cb(const route_head* rte) { route_index++; this_route_valid = ((opt_route_index_value < 1) || (opt_route_index_value == track_index)); } static void -route_disp_wpt_cb(const waypoint *wpt) +route_disp_wpt_cb(const waypoint* wpt) { if (this_route_valid) { - char *sn; + char* sn; if (global_opts.synthesize_shortnames) { sn = mkshort_from_wpt(short_h, wpt); @@ -667,7 +667,7 @@ route_disp_wpt_cb(const waypoint *wpt) } static void -track_disp_custom_cb(const waypoint *wpt) +track_disp_custom_cb(const waypoint* wpt) { if (wpt->GetCreationTime().isValid() && (wpt->altitude != unknown_alt)) { gbfprintf(fout, "%d,%.f\n", (int)(wpt->GetCreationTime().toTime_t() - start_time), wpt->altitude); @@ -675,7 +675,7 @@ track_disp_custom_cb(const waypoint *wpt) } static void -wr_init(const char *fname) +wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); short_h = mkshort_new_handle(); diff --git a/gpsbabel/stmwpp.cc b/gpsbabel/stmwpp.cc index ca42b9c2f..303a2cdbb 100644 --- a/gpsbabel/stmwpp.cc +++ b/gpsbabel/stmwpp.cc @@ -30,9 +30,9 @@ #include #include -static gbfile *fin, *fout; -static route_head *track, *route; -static waypoint *wpt; +static gbfile* fin, *fout; +static route_head* track, *route; +static waypoint* wpt; static short_handle short_h; #define MYNAME "STMwpp" @@ -46,7 +46,7 @@ static int track_index; static int track_num; static int what; -static char *index_opt = NULL; +static char* index_opt = NULL; static arglist_t stmwpp_args[] = { @@ -59,7 +59,7 @@ arglist_t stmwpp_args[] = { static void -stmwpp_rd_init(const char *fname) +stmwpp_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); track = NULL; @@ -76,19 +76,19 @@ stmwpp_rd_deinit(void) static void stmwpp_data_read(void) { - char *buff; + char* buff; int line = 0; what = STM_NOTHING; buff = gbfgetstr(fin); - buff = (buff == NULL) ? (char *) "" : buff; + buff = (buff == NULL) ? (char*) "" : buff; if (case_ignore_strncmp(buff, "Datum,WGS 84,WGS 84,", 20) != 0) { fatal(MYNAME ": Invalid GPS datum or not \"WaypointPlus\"\" file!\n"); } while ((buff = gbfgetstr(fin))) { - char *c; + char* c; int column = -1; struct tm time; @@ -193,7 +193,7 @@ stmwpp_data_read(void) } static void -stmwpp_rw_init(const char *fname) +stmwpp_rw_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); short_h = mkshort_new_handle(); @@ -207,7 +207,7 @@ stmwpp_rw_deinit(void) } static void -stmwpp_track_hdr(const route_head *track) +stmwpp_track_hdr(const route_head* track) { track_num++; } @@ -216,7 +216,7 @@ static void stmwpp_write_double(const double val) { char buff[64]; - char *c; + char* c; c = buff + snprintf(buff, sizeof(buff), "%3.7f", val); while (*--c == '0') { @@ -229,7 +229,7 @@ stmwpp_write_double(const double val) } static void -stmwpp_waypt_cb(const waypoint *wpt) +stmwpp_waypt_cb(const waypoint* wpt) { char cdate[16], ctime[16]; struct tm tm; @@ -247,7 +247,7 @@ stmwpp_waypt_cb(const waypoint *wpt) snprintf(ctime, sizeof(ctime), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); switch (what) { - char *sn; + char* sn; case STM_WAYPT: case STM_RTEPT: diff --git a/gpsbabel/strptime.h b/gpsbabel/strptime.h index 3d37bfda7..3b0d5a9f9 100644 --- a/gpsbabel/strptime.h +++ b/gpsbabel/strptime.h @@ -30,7 +30,7 @@ #ifdef __cplusplus extern "C" { #endif -extern char* strptime(const char*, const char*, struct tm*); + extern char* strptime(const char*, const char*, struct tm*); #ifdef __cplusplus } #endif diff --git a/gpsbabel/subrip.cc b/gpsbabel/subrip.cc index a4bf563e2..f1939b74e 100644 --- a/gpsbabel/subrip.cc +++ b/gpsbabel/subrip.cc @@ -24,21 +24,21 @@ #define MYNAME "subrip" -static char * opt_videotime; -static char * opt_gpstime; -static char * opt_gpsdate; +static char* opt_videotime; +static char* opt_gpstime; +static char* opt_gpsdate; static time_t time_offset; static int stnum; -static gbfile *fout; -static const waypoint * prevwpp; +static gbfile* fout; +static const waypoint* prevwpp; /* internal helper functions */ static time_t -sync_time(time_t arg_gpstime, char * arg_videotime) +sync_time(time_t arg_gpstime, char* arg_videotime) { static time_t videotime_t; - static struct tm * ptm_video; + static struct tm* ptm_video; static time_t result; videotime_t = 0; @@ -64,7 +64,7 @@ static void subrip_write_duration(time_t starttime, time_t endtime) { /* Writes start and end time for subtitle display to file. */ - struct tm * tmptime; + struct tm* tmptime; tmptime = gmtime(&starttime); gbfprintf(fout, "%02d:%02d:%02d,000 --> ", tmptime->tm_hour, tmptime->tm_min, tmptime->tm_sec); @@ -77,14 +77,14 @@ static void subrip_write_time(time_t arg_time) { /* Writes a timestamp to file. */ - struct tm * tmptime; + struct tm* tmptime; tmptime = gmtime(&arg_time); gbfprintf(fout, "%02d:%02d:%02d", tmptime->tm_hour, tmptime->tm_min, tmptime->tm_sec); } static void -subrip_prevwp_pr(const waypoint *waypointp) +subrip_prevwp_pr(const waypoint* waypointp) { /* Now that we have the next waypoint, we can write out the subtitle for * the previous one. @@ -131,7 +131,7 @@ subrip_prevwp_pr(const waypoint *waypointp) /* callback functions */ static void -subrip_trkpt_pr(const waypoint *waypointp) +subrip_trkpt_pr(const waypoint* waypointp) { /* * To determine the duration of the subtitle, we need the timestamp of the @@ -160,10 +160,10 @@ subrip_trkpt_pr(const waypoint *waypointp) /* global callback (exported) functions */ static void -subrip_wr_init(const char *fname) +subrip_wr_init(const char* fname) { time_t gpstime_t; - struct tm * ptm_gps; + struct tm* ptm_gps; stnum = 1; diff --git a/gpsbabel/swapdata.cc b/gpsbabel/swapdata.cc index e5c0b8b8a..40f318386 100644 --- a/gpsbabel/swapdata.cc +++ b/gpsbabel/swapdata.cc @@ -34,9 +34,9 @@ arglist_t swapdata_args[] = { }; static void -swapdata_cb(const waypoint *ref) +swapdata_cb(const waypoint* ref) { - waypoint *wpt = (waypoint *)ref; + waypoint* wpt = (waypoint*)ref; double x; x = wpt->latitude; diff --git a/gpsbabel/tef_xml.cc b/gpsbabel/tef_xml.cc index 1c5d00261..f03082a99 100644 --- a/gpsbabel/tef_xml.cc +++ b/gpsbabel/tef_xml.cc @@ -28,13 +28,13 @@ #include "defs.h" #include "xmlgeneric.h" -static waypoint *wpt_tmp; +static waypoint* wpt_tmp; static int item_count; static int waypoints; static double version; -static route_head *route = NULL; +static route_head* route = NULL; -static char *routevia = NULL; +static char* routevia = NULL; static arglist_t tef_xml_args[] = { { @@ -46,10 +46,10 @@ static arglist_t tef_xml_args[] = { #define MYNAME "TourExchangeFormat" -static char * -trimmed_strdup(const char *str) +static char* +trimmed_strdup(const char* str) { - char *c1, *c2, *res; + char* c1, *c2, *res; c1 = xstrdup(str); c2 = lrtrim(c1); @@ -83,11 +83,11 @@ xg_tag_mapping tef_xml_map[] = { */ void -tef_start(const char *args, const QXmlStreamAttributes* attrv) +tef_start(const char* args, const QXmlStreamAttributes* attrv) { bool valid = false; - foreach (QXmlStreamAttribute attr, *attrv) { + foreach(QXmlStreamAttribute attr, *attrv) { if (attr.name().compare("Comment", Qt::CaseInsensitive) == 0) { if (attr.value().compare("TourExchangeFormat", Qt::CaseInsensitive) == 0) { valid = true; @@ -107,10 +107,10 @@ tef_start(const char *args, const QXmlStreamAttributes* attrv) */ static void -tef_header(const char *args, const QXmlStreamAttributes* attrv) +tef_header(const char* args, const QXmlStreamAttributes* attrv) { route = route_head_alloc(); - foreach (QXmlStreamAttribute attr, *attrv) { + foreach(QXmlStreamAttribute attr, *attrv) { if (attr.name().compare("Name", Qt::CaseInsensitive) == 0) { route->rte_name = trimmed_strdup(attr.value().toString().toUtf8().constData()); } else if (attr.name().compare("Software", Qt::CaseInsensitive) == 0) { @@ -121,7 +121,7 @@ tef_header(const char *args, const QXmlStreamAttributes* attrv) } static void -tef_list_start(const char *args, const QXmlStreamAttributes* attrv) +tef_list_start(const char* args, const QXmlStreamAttributes* attrv) { if (attrv->hasAttribute("ItemCount")) { item_count = attrv->value("ItemCount").toString().toUInt(); @@ -137,11 +137,11 @@ tef_list_start(const char *args, const QXmlStreamAttributes* attrv) * should be "Wittlicher Strasse (L34)" for the example above */ -static char * -fix_notes(const char *name, char *notes) +static char* +fix_notes(const char* name, char* notes) { - const char *cleft, *cright, *cback; - char *ctmp; + const char* cleft, *cright, *cback; + char* ctmp; if ((! name) || (! notes)) { return notes; @@ -195,7 +195,7 @@ waypoint_final() if (route != NULL) { if ((via != 0) || (routevia == NULL)) { - waypoint *wpt = waypt_dupe(wpt_tmp); + waypoint* wpt = waypt_dupe(wpt_tmp); route_add_wpt(route, wpt); } } @@ -208,13 +208,13 @@ waypoint_final() } static void -tef_item_end(const char *args, const QXmlStreamAttributes* unused) +tef_item_end(const char* args, const QXmlStreamAttributes* unused) { waypoint_final(); } static void -tef_list_end(const char *args, const QXmlStreamAttributes* unused) +tef_list_end(const char* args, const QXmlStreamAttributes* unused) { waypoint_final(); if (waypoints != item_count) @@ -223,7 +223,7 @@ tef_list_end(const char *args, const QXmlStreamAttributes* unused) } static void -tef_item_start(const char *args, const QXmlStreamAttributes* attrv) +tef_item_start(const char* args, const QXmlStreamAttributes* attrv) { waypoints++; @@ -232,7 +232,7 @@ tef_item_start(const char *args, const QXmlStreamAttributes* attrv) wpt_tmp->wpt_flags.fmt_use ++; } - foreach (QXmlStreamAttribute attr, *attrv) { + foreach(QXmlStreamAttribute attr, *attrv) { QString attrstr = attr.value().toString(); QByteArray attrtext = attrstr.toUtf8(); @@ -244,7 +244,7 @@ tef_item_start(const char *args, const QXmlStreamAttributes* attrv) attr.value().compare("true", Qt::CaseInsensitive) == 0) { wpt_tmp->wpt_flags.fmt_use = 1; /* only a flag */ - /* new in TEF V2 */ + /* new in TEF V2 */ } else if (attr.name().compare("Instruction", Qt::CaseInsensitive) == 0) { wpt_tmp->description = trimmed_strdup(attrtext.constData()); } else if (attr.name().compare("Altitude", Qt::CaseInsensitive) == 0) { @@ -271,7 +271,7 @@ tef_read_comma_float(const QStringRef& value) } static void -tef_point(const char *args, const QXmlStreamAttributes* attrv) +tef_point(const char* args, const QXmlStreamAttributes* attrv) { if (!wpt_tmp) { return; @@ -287,7 +287,7 @@ tef_point(const char *args, const QXmlStreamAttributes* attrv) } static void -tef_xml_rd_init(const char *fname) +tef_xml_rd_init(const char* fname) { wpt_tmp = NULL; waypoints = 0; diff --git a/gpsbabel/text.cc b/gpsbabel/text.cc index a1bacc4e1..5221d4ca6 100644 --- a/gpsbabel/text.cc +++ b/gpsbabel/text.cc @@ -24,17 +24,17 @@ #include "jeeps/gpsmath.h" #include -static gbfile *file_out; +static gbfile* file_out; static short_handle mkshort_handle; -static char *suppresssep = NULL; -static char *txt_encrypt = NULL; -static char *includelogs = NULL; -static char *degformat = NULL; -static char *altunits = NULL; -static char *split_output = NULL; +static char* suppresssep = NULL; +static char* txt_encrypt = NULL; +static char* includelogs = NULL; +static char* degformat = NULL; +static char* altunits = NULL; +static char* split_output = NULL; static int waypoint_count; -static char *output_name; +static char* output_name; #define MYNAME "TEXT" @@ -72,7 +72,7 @@ arglist_t text_args[] = { static void -wr_init(const char *fname) +wr_init(const char* fname) { waypoint_count = 0; output_name = xstrdup(fname); @@ -93,7 +93,7 @@ wr_deinit(void) } static void -text_disp(const waypoint *wpt) +text_disp(const waypoint* wpt) { int latint, lonint; char tbuf[1024]; @@ -101,14 +101,14 @@ text_disp(const waypoint *wpt) int32_t utmz; double utme, utmn; char utmzc; - char *tmpout1, *tmpout2; - char *altout; - fs_xml *fs_gpx; + char* tmpout1, *tmpout2; + char* altout; + fs_xml* fs_gpx; waypoint_count++; if (split_output) { - char *thisfname; + char* thisfname; xasprintf(&thisfname, "%s%d", output_name, waypoint_count); file_out = gbfopen(thisfname, "w", MYNAME); } @@ -128,7 +128,7 @@ text_disp(const waypoint *wpt) if (wpt->altitude != unknown_alt) { xasprintf(&altout, " alt:%d", (int)((altunits[0]=='f')?METERS_TO_FEET(wpt->altitude):wpt->altitude)); } else { - altout = (char *) ""; + altout = (char*) ""; } xasprintf(&tmpout2, "%s (%d%c %6.0f %7.0f)%s", tmpout1, utmz, utmzc, utme, utmn, altout); gbfprintf(file_out, "%-16s %59s\n", @@ -153,17 +153,17 @@ text_disp(const waypoint *wpt) (int)(wpt->gc_data->diff / 10), (wpt->gc_data->diff%10)?".5":"", (int)(wpt->gc_data->terr / 10), (wpt->gc_data->terr%10)?".5":""); if (!wpt->gc_data->desc_short.utfstring.isEmpty()) { - char *stripped_html = strip_html(&wpt->gc_data->desc_short); + char* stripped_html = strip_html(&wpt->gc_data->desc_short); gbfprintf(file_out, "\n%s\n", stripped_html); xfree(stripped_html); } if (!wpt->gc_data->desc_long.utfstring.isEmpty()) { - char *stripped_html = strip_html(&wpt->gc_data->desc_long); + char* stripped_html = strip_html(&wpt->gc_data->desc_long); gbfprintf(file_out, "\n%s\n", stripped_html); xfree(stripped_html); } if (!wpt->gc_data->hint.isEmpty()) { - char *hint = NULL; + char* hint = NULL; if (txt_encrypt) { hint = rot13(wpt->gc_data->hint); } else { @@ -178,17 +178,17 @@ text_disp(const waypoint *wpt) fs_gpx = NULL; if (includelogs) { - fs_gpx = (fs_xml *)fs_chain_find(wpt->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); } if (fs_gpx && fs_gpx->tag) { - xml_tag *root = fs_gpx->tag; - xml_tag *curlog = NULL; - xml_tag *logpart = NULL; + xml_tag* root = fs_gpx->tag; + xml_tag* curlog = NULL; + xml_tag* logpart = NULL; curlog = xml_findfirst(root, "groundspeak:log"); while (curlog) { time_t logtime = 0; - struct tm *logtm = NULL; + struct tm* logtm = NULL; gbfprintf(file_out, "\n"); logpart = xml_findfirst(curlog, "groundspeak:type"); @@ -216,7 +216,7 @@ text_disp(const waypoint *wpt) logpart = xml_findfirst(curlog, "groundspeak:log_wpt"); if (logpart) { - char *coordstr = NULL; + char* coordstr = NULL; double lat = 0; double lon = 0; coordstr = xml_attribute(logpart, "lat"); @@ -234,8 +234,8 @@ text_disp(const waypoint *wpt) logpart = xml_findfirst(curlog, "groundspeak:text"); if (logpart) { - char *encstr = NULL; - char *s = NULL; + char* encstr = NULL; + char* s = NULL; int encoded = 0; encstr = xml_attribute(logpart, "encoded"); encoded = (toupper(encstr[0]) != 'F'); diff --git a/gpsbabel/tiger.cc b/gpsbabel/tiger.cc index d6b0990b4..b549241ec 100644 --- a/gpsbabel/tiger.cc +++ b/gpsbabel/tiger.cc @@ -24,7 +24,7 @@ #include "defs.h" #include "csv_util.h" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static short_handle mkshort_handle; static short_handle mkshort_whandle; @@ -32,19 +32,19 @@ static short_handle mkshort_whandle; static double maxlat, maxlon, minlat, minlon; static int rec_cnt; -static char *nolabels = NULL; -static char *genurl = NULL; -static char *suppresswhite = NULL; -static char *iconismarker = NULL; -static char *snlen = NULL; - -static char *margin = NULL; -static char *xpixels = NULL; -static char *ypixels = NULL; -static char *oldthresh = NULL; -static char *oldmarker = NULL; -static char *newmarker = NULL; -static char *unfoundmarker = NULL; +static char* nolabels = NULL; +static char* genurl = NULL; +static char* suppresswhite = NULL; +static char* iconismarker = NULL; +static char* snlen = NULL; + +static char* margin = NULL; +static char* xpixels = NULL; +static char* ypixels = NULL; +static char* oldthresh = NULL; +static char* oldmarker = NULL; +static char* newmarker = NULL; +static char* unfoundmarker = NULL; static int short_length; static double thresh_days; @@ -55,8 +55,8 @@ static double thresh_days; * the projection transformations. Some trig geek can finish that. */ #if CLICKMAP -static gbfile *linkf; -static char *clickmap = NULL; +static gbfile* linkf; +static char* clickmap = NULL; #endif @@ -124,7 +124,7 @@ arglist_t tiger_args[] = { static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -138,7 +138,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); thresh_days = strtod(oldthresh, NULL); @@ -156,8 +156,8 @@ data_read(void) double lat,lon; char desc[100]; char icon[100]; - char *ibuf; - waypoint *wpt_tmp; + char* ibuf; + waypoint* wpt_tmp; int line = 0; while ((ibuf = gbfgetstr(file_in))) { @@ -179,7 +179,7 @@ data_read(void) } static void -tiger_disp(const waypoint *wpt) +tiger_disp(const waypoint* wpt) { QString pin; double lat = wpt->latitude; @@ -212,8 +212,8 @@ tiger_disp(const waypoint *wpt) gbfprintf(file_out, "%f,%f:%s", lon, lat, pin.toUtf8().data()); if (!nolabels) { - char *temp = NULL; - char *desc = csv_stringclean(wpt->description, ":"); + char* temp = NULL; + char* desc = csv_stringclean(wpt->description, ":"); if (global_opts.synthesize_shortnames) { temp = desc; desc = mkshort(mkshort_whandle, desc); @@ -229,7 +229,7 @@ tiger_disp(const waypoint *wpt) #if CLICKMAP static void -map_plot(const waypoint *wpt) +map_plot(const waypoint* wpt) { static int x,y; @@ -282,7 +282,7 @@ data_write(void) waypt_disp_all(tiger_disp); if (genurl) { - gbfile *urlf; + gbfile* urlf; urlf = gbfopen(genurl, "w", MYNAME); latsz = fabs(maxlat - minlat); diff --git a/gpsbabel/tmpro.cc b/gpsbabel/tmpro.cc index 78523062c..f6f41e6b1 100644 --- a/gpsbabel/tmpro.cc +++ b/gpsbabel/tmpro.cc @@ -38,11 +38,11 @@ #define MYNAME "TMPro" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static short_handle mkshort_handle; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); } @@ -54,7 +54,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); } @@ -68,10 +68,10 @@ wr_deinit(void) static void data_read(void) { - char *buff; - char *s; - char *holder; - waypoint *wpt_tmp; + char* buff; + char* s; + char* holder; + waypoint* wpt_tmp; int i; int linecount = 0; @@ -175,12 +175,12 @@ data_read(void) } static void -tmpro_waypt_pr(const waypoint * wpt) +tmpro_waypt_pr(const waypoint* wpt) { int icon = 1; /* default to "flag" */ int colour = 255; /*default to red */ - char *shortname = NULL; - char *description = NULL; + char* shortname = NULL; + char* description = NULL; if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) { if (wpt->description) { @@ -212,7 +212,7 @@ tmpro_waypt_pr(const waypoint * wpt) /* Number of characters */ /* 25 6 80 8 8 8 8 8 4 4 128 */ - const char *l = NULL; + const char* l = NULL; if (wpt->HasUrlLink()) { // Yes, it's lame to allocate/copy here. UrlLink link = wpt->GetUrlLink(); diff --git a/gpsbabel/tomtom.cc b/gpsbabel/tomtom.cc index 0fcbb4c3e..feac8a0a1 100644 --- a/gpsbabel/tomtom.cc +++ b/gpsbabel/tomtom.cc @@ -42,8 +42,8 @@ #define MYNAME "TomTom" -static gbfile *file_in; -static gbfile *file_out; +static gbfile* file_in; +static gbfile* file_out; static arglist_t tomtom_args[] = { @@ -51,7 +51,7 @@ arglist_t tomtom_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -63,7 +63,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); } @@ -80,15 +80,15 @@ wr_deinit(void) /* * Decode a type 8 compressed record */ -char * -decode_8(int sz, const unsigned char *inbuf) +char* +decode_8(int sz, const unsigned char* inbuf) { static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-"; static const int encoding_8_high[8] = {0x2,0x3,0x4,0x5,0x6,0x7,0xe,0xf}; // Maximally sized for laziness. - char *rval = (char *) xmalloc(sz * 3 + 1); - char *out = rval; + char* rval = (char*) xmalloc(sz * 3 + 1); + char* out = rval; int i; for (i = 0; i < sz;) { @@ -121,7 +121,7 @@ decode_8(int sz, const unsigned char *inbuf) } void -decode_latlon(double *lat, double *lon) +decode_latlon(double* lat, double* lon) { unsigned char latbuf[3]; unsigned char lonbuf[3]; @@ -151,8 +151,8 @@ data_read(void) long recsize; long x; long y; - char *desc; - waypoint *wpt_tmp; + char* desc; + waypoint* wpt_tmp; while (!gbfeof(file_in)) { rectype = read_char(file_in); if (rectype == EOF) { @@ -188,7 +188,7 @@ data_read(void) check_recsize(recsize); x = read_long(file_in); y = read_long(file_in); - desc = (char *)xmalloc(recsize - 13); + desc = (char*)xmalloc(recsize - 13); gbfread(desc, recsize-13, 1, file_in); wpt_tmp = waypt_new(); @@ -239,17 +239,17 @@ data_read(void) struct hdr { - waypoint *wpt; + waypoint* wpt; }; -static int compare_lon(const void *a, const void *b); +static int compare_lon(const void* a, const void* b); static int -compare_lat(const void *a, const void *b) +compare_lat(const void* a, const void* b) { - const struct hdr *wa = (const struct hdr*) a; - const struct hdr *wb = (const struct hdr*) b; + const struct hdr* wa = (const struct hdr*) a; + const struct hdr* wb = (const struct hdr*) b; double difference = wa->wpt->latitude - wb->wpt->latitude; if (difference < 0) { @@ -266,10 +266,10 @@ compare_lat(const void *a, const void *b) static int -compare_lon(const void *a, const void *b) +compare_lon(const void* a, const void* b) { - const struct hdr *wa = (const struct hdr*)a; - const struct hdr *wb = (const struct hdr*)b; + const struct hdr* wa = (const struct hdr*)a; + const struct hdr* wb = (const struct hdr*)b; double difference = wa->wpt->longitude - wb->wpt->longitude; if (difference < 0) { @@ -287,7 +287,7 @@ compare_lon(const void *a, const void *b) #define write_long(f,v) gbfputint32((v),f) static void -write_float_as_long(gbfile *file, double value) +write_float_as_long(gbfile* file, double value) { long tmp = (value + 0.500000000001); write_long(file, tmp); @@ -297,19 +297,19 @@ write_float_as_long(gbfile *file, double value) #define write_string(f,s) gbfputcstr((s),f) struct blockheader { - struct hdr *start; + struct hdr* start; long count; long size; double minlat; double maxlat; double minlon; double maxlon; - struct blockheader *ch1; - struct blockheader *ch2; + struct blockheader* ch1; + struct blockheader* ch2; }; static void -write_blocks(gbfile *f, struct blockheader *blocks) +write_blocks(gbfile* f, struct blockheader* blocks) { int i; write_char(f, 1); @@ -350,12 +350,12 @@ write_blocks(gbfile *f, struct blockheader *blocks) } } -static struct blockheader * -compute_blocks(struct hdr *start, int count, +static struct blockheader* +compute_blocks(struct hdr* start, int count, double minlon, double maxlon, double minlat, double maxlat) { - struct blockheader *newblock; + struct blockheader* newblock; - newblock = (struct blockheader *)xcalloc(sizeof(*newblock), 1); + newblock = (struct blockheader*)xcalloc(sizeof(*newblock), 1); newblock->start = start; newblock->count = count; newblock->minlon = minlon; @@ -365,7 +365,7 @@ compute_blocks(struct hdr *start, int count, newblock->size = 4 * 5 + 1; /* hdr is 5 longs, 1 char */ if (count < 20) { int i; - waypoint *wpt = NULL; + waypoint* wpt = NULL; for (i = 0; i < count; i++) { newblock->size += 4 * 3 + 1; @@ -404,7 +404,7 @@ compute_blocks(struct hdr *start, int count, } static void -free_blocks(struct blockheader *block) +free_blocks(struct blockheader* block) { if (block->ch1) { free_blocks(block->ch1); @@ -419,21 +419,21 @@ static void data_write(void) { int ct = waypt_count(); - struct hdr *htable, *bh; - queue *elem, *tmp; + struct hdr* htable, *bh; + queue* elem, *tmp; extern queue waypt_head; - waypoint *waypointp; + waypoint* waypointp; double minlon = 200; double maxlon = -200; double minlat = 200; double maxlat = -200; - struct blockheader *blocks = NULL; + struct blockheader* blocks = NULL; htable = (struct hdr*) xmalloc(ct * sizeof(*htable)); bh = htable; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; bh->wpt = waypointp; if (waypointp->longitude > maxlon) { maxlon = waypointp->longitude; diff --git a/gpsbabel/tpg.cc b/gpsbabel/tpg.cc index bc8c0fa8d..ac33e0ce6 100644 --- a/gpsbabel/tpg.cc +++ b/gpsbabel/tpg.cc @@ -32,10 +32,10 @@ #define MAXTPGSTRINGSIZE 256 #define MAXTPGOUTPUTPINS 65535 -static gbfile *tpg_file_in; -static gbfile *tpg_file_out; +static gbfile* tpg_file_in; +static gbfile* tpg_file_out; static short_handle mkshort_handle; -static char *tpg_datum_opt; +static char* tpg_datum_opt; static int tpg_datum_idx; static unsigned int waypt_out_count; @@ -47,7 +47,7 @@ arglist_t tpg_args[] = { }; static int -valid_tpg_header(char * header, int len) +valid_tpg_header(char* header, int len) { unsigned char header_bytes[] = { 0xFF, 0xFF, 0x01, 0x00, 0x0D, 0x00, 0x43, 0x54, 0x6F, 0x70, @@ -71,7 +71,7 @@ tpg_common_init(void) } static void -tpg_rd_init(const char *fname) +tpg_rd_init(const char* fname) { tpg_common_init(); tpg_file_in = gbfopen_le(fname, "rb", MYNAME); @@ -84,7 +84,7 @@ tpg_rd_deinit(void) } static void -tpg_wr_init(const char *fname) +tpg_wr_init(const char* fname) { tpg_common_init(); tpg_file_out = gbfopen_le(fname, "wb", MYNAME); @@ -103,7 +103,7 @@ static void tpg_read(void) { char buff[MAXTPGSTRINGSIZE + 1]; - waypoint *wpt_tmp; + waypoint* wpt_tmp; double lat, lon, elev; double amt; short int pointcount; @@ -166,15 +166,15 @@ tpg_read(void) } static void -tpg_waypt_pr(const waypoint *wpt) +tpg_waypt_pr(const waypoint* wpt) { double lon, lat; double amt; short int elev; char tbuf[64]; char c,ocount; - char *shortname; - char *description; + char* shortname; + char* description; int i; /* these unknown 4 are probably point properties (color, icon, etc..) */ diff --git a/gpsbabel/tpo.cc b/gpsbabel/tpo.cc index 8700de180..b317c3fd6 100644 --- a/gpsbabel/tpo.cc +++ b/gpsbabel/tpo.cc @@ -495,7 +495,7 @@ waypoint* tpo_convert_ll(int lat, int lon) } #define TRACKNAMELENGTH 256 -struct style_info{ +struct style_info { char name[TRACKNAMELENGTH]; // some huge value uint8_t color[3]; // keep R/G/B values separate because line_color needs BGR uint8_t wide; @@ -527,7 +527,7 @@ void tpo_process_tracks(void) printf("Unpacking %d track styles...\n",track_style_count); } - style_info *styles = (style_info *)xcalloc(track_style_count, sizeof(style_info)); + style_info* styles = (style_info*)xcalloc(track_style_count, sizeof(style_info)); for (ii = 0; ii < track_style_count; ii++) { @@ -541,7 +541,7 @@ void tpo_process_tracks(void) // Topo and web uses rrggbb, also need line_color.bbggrr for KML for (xx = 0; xx < 3; xx++) { int col = (int)gbfgetc(tpo_file_in); - if((col < 0) || (col >255)) { + if ((col < 0) || (col >255)) { col = 0; // assign black if out of range 0x00 to 0xff } styles[ii].color[xx] = (uint8_t)col; @@ -665,7 +665,7 @@ void tpo_process_tracks(void) // track texture (dashed=1, solid=0) mapped into opacity - not assigned before 2012 track_temp->line_color.opacity = 0xff; // 255 - if(styles[track_style].dash) { + if (styles[track_style].dash) { track_temp->line_color.opacity = 0x50; } @@ -679,7 +679,7 @@ void tpo_process_tracks(void) // Track description // track_temp->rte_desc = NULL; // pre-2012 default, next line from SRE saves track style as track description xasprintf(&track_temp->rte_desc, "Style=%s, Width=%d, Dashed=%d, Color=#%s", - styles[track_style].name, styles[track_style].wide, styles[track_style].dash, rgb); + styles[track_style].name, styles[track_style].wide, styles[track_style].dash, rgb); // Route number track_temp->rte_num = ii+1; diff --git a/gpsbabel/trackfilter.cc b/gpsbabel/trackfilter.cc index 89074a539..4ad889de6 100644 --- a/gpsbabel/trackfilter.cc +++ b/gpsbabel/trackfilter.cc @@ -71,23 +71,23 @@ #undef TRACKF_DBG -static char *opt_merge = NULL; -static char *opt_pack = NULL; -static char *opt_split = NULL; -static char *opt_sdistance = NULL; -static char *opt_move = NULL; -static char *opt_title = NULL; -static char *opt_start = NULL; -static char *opt_stop = NULL; -static char *opt_fix = NULL; -static char *opt_course = NULL; -static char *opt_speed = NULL; -static char *opt_name = NULL; -static char *opt_seg2trk = NULL; -static char *opt_trk2seg = NULL; -static char *opt_segment = NULL; -static char *opt_faketime = NULL; -static char *opt_discard = NULL; +static char* opt_merge = NULL; +static char* opt_pack = NULL; +static char* opt_split = NULL; +static char* opt_sdistance = NULL; +static char* opt_move = NULL; +static char* opt_title = NULL; +static char* opt_start = NULL; +static char* opt_stop = NULL; +static char* opt_fix = NULL; +static char* opt_course = NULL; +static char* opt_speed = NULL; +static char* opt_name = NULL; +static char* opt_seg2trk = NULL; +static char* opt_trk2seg = NULL; +static char* opt_segment = NULL; +static char* opt_faketime = NULL; +static char* opt_discard = NULL; static arglist_t trackfilter_args[] = { @@ -177,12 +177,12 @@ arglist_t trackfilter_args[] = { typedef struct trkflt_s { - route_head *track; + route_head* track; QDateTime first_time; QDateTime last_time; } trkflt_t; -static trkflt_t *track_list = NULL; +static trkflt_t* track_list = NULL; static int track_ct = 0; static int track_pts = 0; static int timeless_pts = 0; @@ -198,7 +198,7 @@ static int trackfilter_opt_count(void) { int res = 0; - arglist_t *a = trackfilter_args; + arglist_t* a = trackfilter_args; while (a->argstring) { if (*a->argval != NULL) { @@ -210,11 +210,11 @@ trackfilter_opt_count(void) } static int -trackfilter_parse_time_opt(const char *arg) +trackfilter_parse_time_opt(const char* arg) { time_t t0, t1; int sign = 1; - char *cin = (char *)arg; + char* cin = (char*)arg; char c; t0 = t1 = 0; @@ -257,10 +257,10 @@ trackfilter_parse_time_opt(const char *arg) } static int -trackfilter_init_qsort_cb(const void *a, const void *b) +trackfilter_init_qsort_cb(const void* a, const void* b) { - const trkflt_t *ra = (const trkflt_t*) a; - const trkflt_t *rb = (const trkflt_t*) b; + const trkflt_t* ra = (const trkflt_t*) a; + const trkflt_t* rb = (const trkflt_t*) b; const QDateTime dta = ra->first_time; const QDateTime dtb = rb->first_time; @@ -274,10 +274,10 @@ trackfilter_init_qsort_cb(const void *a, const void *b) } static int -trackfilter_merge_qsort_cb(const void *a, const void *b) +trackfilter_merge_qsort_cb(const void* a, const void* b) { - const waypoint *wa = *(waypoint **)a; - const waypoint *wb = *(waypoint **)b; + const waypoint* wa = *(waypoint**)a; + const waypoint* wb = *(waypoint**)b; const QDateTime dta = wa->GetCreationTime(); const QDateTime dtb = wb->GetCreationTime(); @@ -291,7 +291,7 @@ trackfilter_merge_qsort_cb(const void *a, const void *b) } static fix_type -trackfilter_parse_fix(int *nsats) +trackfilter_parse_fix(int* nsats) { if (!opt_fix) { return fix_unknown; @@ -321,40 +321,42 @@ trackfilter_parse_fix(int *nsats) } static void -trackfilter_fill_track_list_cb(const route_head *track) /* callback for track_disp_all */ +trackfilter_fill_track_list_cb(const route_head* track) /* callback for track_disp_all */ { int i; - waypoint *wpt, *prev; - queue *elem, *tmp; + waypoint* wpt, *prev; + queue* elem, *tmp; if (track->rte_waypt_ct == 0) { - track_del_head((route_head *)track); + track_del_head((route_head*)track); return; } if (opt_name != NULL) { if ((track->rte_name == NULL) || (case_ignore_str_match(track->rte_name, opt_name) == 0)) { - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; - track_del_wpt((route_head *)track, wpt); + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; + track_del_wpt((route_head*)track, wpt); waypt_free(wpt); } - track_del_head((route_head *)track); + track_del_head((route_head*)track); return; } } - track_list[track_ct].track = (route_head *)track; + track_list[track_ct].track = (route_head*)track; i = 0; prev = NULL; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { track_pts++; - wpt = (waypoint *)elem; - if (!wpt->creation_time.isValid()) timeless_pts++; + wpt = (waypoint*)elem; + if (!wpt->creation_time.isValid()) { + timeless_pts++; + } if (!(opt_merge && opt_discard) && (need_time != 0) && (!wpt->creation_time.isValid())) { fatal(MYNAME "-init: Found track point at %f,%f without time!\n", wpt->latitude, wpt->longitude); @@ -384,7 +386,7 @@ trackfilter_fill_track_list_cb(const route_head *track) /* callback for track_d *******************************************************************************/ static void -trackfilter_split_init_rte_name(route_head *track, const QDateTime dt) +trackfilter_split_init_rte_name(route_head* track, const QDateTime dt) { char buff[128], tbuff[128]; struct tm tm; @@ -415,18 +417,18 @@ trackfilter_split_init_rte_name(route_head *track, const QDateTime dt) } static void -trackfilter_pack_init_rte_name(route_head *track, const time_t default_time) +trackfilter_pack_init_rte_name(route_head* track, const time_t default_time) { char buff[128]; if (strchr(opt_title, '%') != NULL) { struct tm tm; - waypoint *wpt; + waypoint* wpt; if (track->rte_waypt_ct == 0) { tm = *localtime(&default_time); } else { - wpt = (waypoint *) QUEUE_FIRST((queue *)&track->waypoint_list); + wpt = (waypoint*) QUEUE_FIRST((queue*)&track->waypoint_list); time_t t = wpt->GetCreationTime().toTime_t(); tm = *localtime(&t); } @@ -458,7 +460,7 @@ trackfilter_title(void) fatal(MYNAME "-title: Missing your title!\n"); } for (i = 0; i < track_ct; i++) { - route_head *track = track_list[i].track; + route_head* track = track_list[i].track; trackfilter_pack_init_rte_name(track, 0); } } @@ -472,7 +474,7 @@ trackfilter_pack(void) { int i, j; trkflt_t prev; - route_head *master; + route_head* master; for (i = 1, j = 0; i < track_ct; i++, j++) { prev = track_list[j]; @@ -486,11 +488,11 @@ trackfilter_pack(void) master = track_list[0].track; for (i = 1; i < track_ct; i++) { - queue *elem, *tmp; - route_head *curr = track_list[i].track; + queue* elem, *tmp; + route_head* curr = track_list[i].track; - QUEUE_FOR_EACH((queue *)&curr->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&curr->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; track_del_wpt(curr, wpt); track_add_wpt(master, wpt); } @@ -509,23 +511,23 @@ trackfilter_merge(void) { int i, j, dropped; - queue *elem, *tmp; - waypoint **buff; - waypoint *prev, *wpt; - route_head *master = track_list[0].track; + queue* elem, *tmp; + waypoint** buff; + waypoint* prev, *wpt; + route_head* master = track_list[0].track; if (track_pts-timeless_pts < 1) { return; } - buff = (waypoint **)xcalloc(track_pts-timeless_pts, sizeof(*buff)); + buff = (waypoint**)xcalloc(track_pts-timeless_pts, sizeof(*buff)); j = 0; for (i = 0; i < track_ct; i++) { /* put all points into temp buffer */ - route_head *track = track_list[i].track; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - wpt = (waypoint *)elem; - if(wpt->creation_time.isValid()) { + route_head* track = track_list[i].track; + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + wpt = (waypoint*)elem; + if (wpt->creation_time.isValid()) { buff[j++] = waypt_dupe(wpt); } track_del_wpt(track, wpt); @@ -566,13 +568,13 @@ trackfilter_merge(void) static void trackfilter_split(void) { - route_head *curr; - route_head *master = track_list[0].track; + route_head* curr; + route_head* master = track_list[0].track; int count = master->rte_waypt_ct; - waypoint **buff; - waypoint *wpt; - queue *elem, *tmp; + waypoint** buff; + waypoint* wpt; + queue* elem, *tmp; int i, j; double interval = -1; double distance = -1; @@ -680,11 +682,11 @@ trackfilter_split(void) trackfilter_split_init_rte_name(master, track_list[0].first_time); - buff = (waypoint **) xcalloc(count, sizeof(*buff)); + buff = (waypoint**) xcalloc(count, sizeof(*buff)); i = 0; - QUEUE_FOR_EACH((queue *)&master->waypoint_list, elem, tmp) { - wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&master->waypoint_list, elem, tmp) { + wpt = (waypoint*)elem; buff[i++] = wpt; } @@ -746,7 +748,7 @@ trackfilter_split(void) #ifdef TRACKF_DBG printf(MYNAME ": splitting new track\n"); #endif - curr = (route_head *) route_head_alloc(); + curr = (route_head*) route_head_alloc(); trackfilter_split_init_rte_name(curr, buff[j]->GetCreationTime()); track_add_head(curr); } @@ -768,8 +770,8 @@ static void trackfilter_move(void) { int i; - queue *elem, *tmp; - waypoint *wpt; + queue* elem, *tmp; + waypoint* wpt; time_t delta; delta = trackfilter_parse_time_opt(opt_move); @@ -778,9 +780,9 @@ trackfilter_move(void) } for (i = 0; i < track_ct; i++) { - route_head *track = track_list[i].track; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - wpt = (waypoint *)elem; + route_head* track = track_list[i].track; + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + wpt = (waypoint*)elem; wpt->creation_time += delta; } @@ -797,8 +799,8 @@ static void trackfilter_synth(void) { int i; - queue *elem, *tmp; - waypoint *wpt; + queue* elem, *tmp; + waypoint* wpt; double oldlat = -999; double oldlon = -999; @@ -810,10 +812,10 @@ trackfilter_synth(void) fix = trackfilter_parse_fix(&nsats); for (i = 0; i < track_ct; i++) { - route_head *track = track_list[i].track; + route_head* track = track_list[i].track; first = 1; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + wpt = (waypoint*)elem; if (opt_fix) { wpt->fix = fix; if (wpt->sat == 0) { @@ -859,18 +861,18 @@ trackfilter_synth(void) *******************************************************************************/ static time_t -trackfilter_range_check(const char *timestr) +trackfilter_range_check(const char* timestr) { int i; char fmt[20]; char c; - char *cin; + char* cin; struct tm time; i = 0; strncpy(fmt, "00000101000000", sizeof(fmt)); - cin = (char *)timestr; + cin = (char*)timestr; while ((c = *cin++)) { if (fmt[i] == '\0') { @@ -893,7 +895,7 @@ static int trackfilter_range(void) /* returns number of track points left after filtering */ { time_t start, stop; - queue *elem, *tmp; + queue* elem, *tmp; int i, dropped, inside = 0; if (opt_start != 0) { @@ -911,10 +913,10 @@ trackfilter_range(void) /* returns number of track points left after filtering dropped = inside = 0; for (i = 0; i < track_ct; i++) { - route_head *track = track_list[i].track; + route_head* track = track_list[i].track; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; if (wpt->creation_time.isValid()) { inside = ((wpt->GetCreationTime().toTime_t() >= start) && (wpt->GetCreationTime().toTime_t() <= stop)); } @@ -954,14 +956,14 @@ trackfilter_seg2trk(void) int i; for (i = 0; i < track_ct; i++) { - queue *elem, *tmp; - route_head *src = track_list[i].track; - route_head *dest = NULL; - route_head *insert_point = src; + queue* elem, *tmp; + route_head* src = track_list[i].track; + route_head* dest = NULL; + route_head* insert_point = src; int trk_seg_num = 1, first = 1; - QUEUE_FOR_EACH((queue *)&src->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&src->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; if (wpt->wpt_flags.new_trkseg && !first) { dest = route_head_alloc(); @@ -1002,17 +1004,17 @@ static void trackfilter_trk2seg(void) { int i, first; - route_head *master; + route_head* master; master = track_list[0].track; for (i = 1; i < track_ct; i++) { - queue *elem, *tmp; - route_head *curr = track_list[i].track; + queue* elem, *tmp; + route_head* curr = track_list[i].track; first = 1; - QUEUE_FOR_EACH((queue *)&curr->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&curr->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; int orig_new_trkseg = wpt->wpt_flags.new_trkseg; @@ -1042,13 +1044,13 @@ typedef struct faketime_s { } faketime_t; static faketime_t -trackfilter_faketime_check(const char *timestr) +trackfilter_faketime_check(const char* timestr) { int i, j; char fmtstart[20]; char fmtstep[20]; char c; - const char *cin; + const char* cin; struct tm time; int timeparse = 1; faketime_t result; @@ -1103,7 +1105,7 @@ trackfilter_faketime(void) /* returns number of track points left af { faketime_t faketime; - queue *elem, *tmp; + queue* elem, *tmp; int i, dropped, inside = 0; if (opt_faketime != 0) { @@ -1113,10 +1115,10 @@ trackfilter_faketime(void) /* returns number of track points left af dropped = inside = 0; for (i = 0; i < track_ct; i++) { - route_head *track = track_list[i].track; + route_head* track = track_list[i].track; - QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; if (opt_faketime != 0 && (!wpt->creation_time.isValid() || faketime.force)) { wpt->creation_time = QDateTime::fromTime_t(faketime.start); @@ -1129,7 +1131,7 @@ trackfilter_faketime(void) /* returns number of track points left af } static int -trackfilter_points_are_same(const waypoint *wpta, const waypoint *wptb) +trackfilter_points_are_same(const waypoint* wpta, const waypoint* wptb) { // We use a simpler (non great circle) test for lat/lon here as this // is used for keeping the 'bookends' of non-moving points. @@ -1153,18 +1155,18 @@ trackfilter_points_are_same(const waypoint *wpta, const waypoint *wptb) } static void -trackfilter_segment_head(const route_head *rte) +trackfilter_segment_head(const route_head* rte) { - queue *elem, *tmp; + queue* elem, *tmp; double avg_dist = 0; int index = 0; - waypoint *prev_wpt = NULL; + waypoint* prev_wpt = NULL; // Consider tossing trackpoints closer than this in radians. // (Empirically determined; It's a few dozen feet.) const double ktoo_close = 0.000005; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; if (index > 0) { double cur_dist = gcdist(RAD(prev_wpt->latitude), RAD(prev_wpt->longitude), @@ -1176,11 +1178,11 @@ trackfilter_segment_head(const route_head *rte) } if (cur_dist < ktoo_close) { - if (wpt != (waypoint *) QUEUE_LAST(&rte->waypoint_list)) { - waypoint *next_wpt = (waypoint *) QUEUE_NEXT(&wpt->Q); + if (wpt != (waypoint*) QUEUE_LAST(&rte->waypoint_list)) { + waypoint* next_wpt = (waypoint*) QUEUE_NEXT(&wpt->Q); if (trackfilter_points_are_same(prev_wpt, wpt) && trackfilter_points_are_same(wpt, next_wpt)) { - track_del_wpt((route_head *)rte, wpt); + track_del_wpt((route_head*)rte, wpt); continue; } } @@ -1202,7 +1204,7 @@ trackfilter_segment_head(const route_head *rte) *******************************************************************************/ static void -trackfilter_init(const char *args) +trackfilter_init(const char* args) { int count = track_count(); diff --git a/gpsbabel/transform.cc b/gpsbabel/transform.cc index f70e25e41..46bc0f329 100644 --- a/gpsbabel/transform.cc +++ b/gpsbabel/transform.cc @@ -30,10 +30,10 @@ #define MYNAME "transform" static char current_target; -static route_head *current_trk; -static route_head *current_rte; +static route_head* current_trk; +static route_head* current_rte; -static char *opt_routes, *opt_tracks, *opt_waypts, *opt_delete; +static char* opt_routes, *opt_tracks, *opt_waypts, *opt_delete; static arglist_t transform_args[] = { @@ -59,7 +59,7 @@ arglist_t transform_args[] = { static void transform_waypoints(void) { - route_head *rte; + route_head* rte; rte = route_head_alloc(); switch (current_target) { @@ -73,9 +73,9 @@ transform_waypoints(void) #if NEWQ foreach(waypoint* wpt, waypt_list) { #else - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypoint *wpt = (waypoint *) elem; + waypoint* wpt = (waypoint*) elem; #endif wpt = waypt_dupe(wpt); @@ -91,7 +91,7 @@ transform_waypoints(void) } static void -transform_rte_disp_hdr_cb(const route_head *rte) +transform_rte_disp_hdr_cb(const route_head* rte) { if (current_target == 'T') { current_trk = route_head_alloc(); @@ -104,7 +104,7 @@ transform_rte_disp_hdr_cb(const route_head *rte) } static void -transform_trk_disp_hdr_cb(const route_head *trk) +transform_trk_disp_hdr_cb(const route_head* trk) { if (current_target == 'R') { current_rte = route_head_alloc(); @@ -117,9 +117,9 @@ transform_trk_disp_hdr_cb(const route_head *trk) } static void -transform_any_disp_wpt_cb(const waypoint *wpt) +transform_any_disp_wpt_cb(const waypoint* wpt) { - waypoint *temp = waypt_dupe(wpt); + waypoint* temp = waypt_dupe(wpt); if (current_target == 'R') { route_add_wpt(current_rte, temp); } else if (current_target == 'T') { @@ -146,7 +146,7 @@ transform_tracks(void) *******************************************************************************/ static void -transform_init(const char *args) +transform_init(const char* args) { } diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index 976bf75de..0004845e5 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -129,7 +129,7 @@ typedef enum { #define unicsv_unknown 1e25 typedef struct { - const char *name; + const char* name; field_e type; uint32_t options; } field_t; @@ -247,18 +247,18 @@ static field_t fields_def[] = { { NULL, fld_terminator, 0 } }; -static field_e *unicsv_fields_tab; +static field_e* unicsv_fields_tab; static int unicsv_fields_tab_ct; static double unicsv_altscale, unicsv_depthscale, unicsv_proximityscale ; -static const char *unicsv_fieldsep; -static gbfile *fin, *fout; +static const char* unicsv_fieldsep; +static gbfile* fin, *fout; static gpsdata_type unicsv_data_type; -static route_head *unicsv_track, *unicsv_route; +static route_head* unicsv_track, *unicsv_route; static char unicsv_outp_flags[(fld_terminator + 8) / 8]; static grid_type unicsv_grid_idx; static int unicsv_datum_idx; -static char *opt_datum, *opt_grid, *opt_utc, *opt_filename, *opt_format, *opt_prec; +static char* opt_datum, *opt_grid, *opt_utc, *opt_filename, *opt_format, *opt_prec; static int unicsv_waypt_ct; static char unicsv_detect; static int llprec; @@ -299,7 +299,7 @@ static arglist_t unicsv_args[] = { /* here we only need a simple yes(0) or no(1) */ static int -unicsv_strrcmp(const char *s1, const char *s2) +unicsv_strrcmp(const char* s1, const char* s2) { int l1, l2; @@ -313,7 +313,7 @@ unicsv_strrcmp(const char *s1, const char *s2) } static int -unicsv_parse_gc_id(const char *str) +unicsv_parse_gc_id(const char* str) { int res = 0; @@ -351,7 +351,7 @@ unicsv_parse_gc_id(const char *str) // static int unicsv_parse_time(const char *str, int *msec, time_t *date); static time_t -unicsv_parse_date(const char *str, int *consumed) +unicsv_parse_date(const char* str, int* consumed) { int p1, p2, p3, ct; char sep[2]; @@ -407,7 +407,7 @@ unicsv_parse_date(const char *str, int *consumed) } static time_t -unicsv_parse_time(const char *str, int *msec, time_t *date) +unicsv_parse_time(const char* str, int* msec, time_t* date) { int hour, min, ct, sec; int consumed = 0; @@ -443,7 +443,7 @@ unicsv_parse_time(const char *str, int *msec, time_t *date) #ifdef UNICSV_GC_READY static status_type -unicsv_parse_status(const char *str) +unicsv_parse_status(const char* str) { if ((case_ignore_strcmp(str, "true") == 0) || (case_ignore_strcmp(str, "yes") == 0) || @@ -461,7 +461,7 @@ unicsv_parse_status(const char *str) #ifdef UNICSV_GC_READY static QDateTime -unicsv_adjust_time(const time_t time, time_t *date) +unicsv_adjust_time(const time_t time, time_t* date) { time_t res = time; if (date) { @@ -478,10 +478,10 @@ unicsv_adjust_time(const time_t time, time_t *date) #endif static char -unicsv_compare_fields(char *s, const field_t *f) +unicsv_compare_fields(char* s, const field_t* f) { - char *name = (char *)f->name; - char *test = s; + char* name = (char*)f->name; + char* test = s; char result; if (!(f->options & STR_CASE)) { @@ -505,13 +505,13 @@ unicsv_compare_fields(char *s, const field_t *f) if ((! result) && (strchr(test, ' ') != NULL)) { /* replace ' ' with '_' and try again */ - char *tmp = gstrsub(test, " ", "_"); + char* tmp = gstrsub(test, " ", "_"); result = unicsv_compare_fields(tmp, f); xfree(tmp); } if ((! result) && (strchr(test, '-') != NULL)) { /* replace '-' with '_' and try again */ - char *tmp = gstrsub(test, "-", "_"); + char* tmp = gstrsub(test, "-", "_"); result = unicsv_compare_fields(tmp, f); xfree(tmp); } @@ -526,12 +526,12 @@ unicsv_compare_fields(char *s, const field_t *f) static void -unicsv_fondle_header(char *ibuf) +unicsv_fondle_header(char* ibuf) { - char *s; - char *buf = NULL; + char* s; + char* buf = NULL; int i, column; - const cet_cs_vec_t *ascii = &cet_cs_vec_ansi_x3_4_1968; /* us-ascii */ + const cet_cs_vec_t* ascii = &cet_cs_vec_ansi_x3_4_1968; /* us-ascii */ /* Convert the entire header to lower case for convenience. * If we see a tab in that header, we decree it to be tabsep. @@ -562,7 +562,7 @@ unicsv_fondle_header(char *ibuf) column = -1; while ((s = csv_lineparse(ibuf, unicsv_fieldsep, "\"", 0))) { - field_t *f = &fields_def[0]; + field_t* f = &fields_def[0]; ibuf = NULL; column++; @@ -620,9 +620,9 @@ unicsv_fondle_header(char *ibuf) } static void -unicsv_rd_init(const char *fname) +unicsv_rd_init(const char* fname) { - char *c; + char* c; unicsv_altscale = 1.0; unicsv_depthscale = 1.0; unicsv_proximityscale = 1.0; @@ -657,10 +657,10 @@ unicsv_rd_deinit(void) } static void -unicsv_parse_one_line(char *ibuf) +unicsv_parse_one_line(char* ibuf) { - char *s; - waypoint *wpt = NULL; + char* s; + waypoint* wpt = NULL; int column; int utm_zone = -9999; double utm_easting = 0; @@ -675,14 +675,14 @@ unicsv_parse_one_line(char *ibuf) time_t date = -1, time = -1; int msec = -1; char is_localtime = 0; - garmin_fs_t *gmsd; + garmin_fs_t* gmsd; double d; struct tm ymd; int src_datum = unicsv_datum_idx; int ns = 1; int ew = 1; #ifdef UNICSV_GC_READY - geocache_data *gc_data = NULL; + geocache_data* gc_data = NULL; #endif wpt = waypt_new(); wpt->latitude = unicsv_unknown; @@ -745,11 +745,11 @@ unicsv_parse_one_line(char *ibuf) break; case fld_url: { -qDebug() << s; + qDebug() << s; UrlLink l(s); wpt->AddUrlLink(l); - } - break; + } + break; case fld_altitude: if (parse_distance(s, &d, unicsv_altscale, MYNAME)) { @@ -1021,7 +1021,7 @@ qDebug() << s; gmsd = GMSD_FIND(wpt); if (! gmsd) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } switch (unicsv_fields_tab[column]) { case fld_garmin_city: @@ -1253,7 +1253,7 @@ qDebug() << s; static void unicsv_rd(void) { - char *buff; + char* buff; if (unicsv_fieldsep == NULL) { return; @@ -1271,7 +1271,7 @@ unicsv_rd(void) /* =========================================================================== */ static void -unicsv_fatal_outside(const waypoint *wpt) +unicsv_fatal_outside(const waypoint* wpt) { gbfprintf(fout, "#####\n"); fatal(MYNAME ": %s (%s) is outside of convertable area of grid \"%s\"!\n", @@ -1281,10 +1281,10 @@ unicsv_fatal_outside(const waypoint *wpt) } static void -unicsv_print_str(const char *str) +unicsv_print_str(const char* str) { if (str && *str) { - char *cout, *cx; + char* cout, *cx; cout = strenquote(str, UNICSV_QUOT_CHAR); @@ -1312,7 +1312,7 @@ unicsv_print_str(const char *str) static void unicsv_print_str(const QString& s) { - char *t = xstrdup(s.toUtf8().data()); + char* t = xstrdup(s.toUtf8().data()); unicsv_print_str(t); xfree(t); } @@ -1343,10 +1343,10 @@ unicsv_print_data_time(const time_t atime) #define FIELD_USED(a) (gb_getbit(&unicsv_outp_flags, a)) static void -unicsv_waypt_enum_cb(const waypoint *wpt) +unicsv_waypt_enum_cb(const waypoint* wpt) { - const char *shortname; - garmin_fs_t *gmsd; + const char* shortname; + garmin_fs_t* gmsd; shortname = (wpt->shortname) ? wpt->shortname : ""; gmsd = GMSD_FIND(wpt); @@ -1455,7 +1455,7 @@ unicsv_waypt_enum_cb(const waypoint *wpt) #ifdef UNICSV_GC_READY if (! waypt_empty_gc_data(wpt)) { - const geocache_data *gc_data = wpt->gc_data; + const geocache_data* gc_data = wpt->gc_data; if (gc_data->id) { gb_setbit(&unicsv_outp_flags, fld_gc_id); @@ -1498,14 +1498,14 @@ unicsv_waypt_enum_cb(const waypoint *wpt) } static void -unicsv_waypt_disp_cb(const waypoint *wpt) +unicsv_waypt_disp_cb(const waypoint* wpt) { double lat, lon, alt; - char *cout = NULL; - const char *shortname; - garmin_fs_t *gmsd; + char* cout = NULL; + const char* shortname; + garmin_fs_t* gmsd; #ifdef UNICSV_GC_READY - const geocache_data *gc_data = NULL; + const geocache_data* gc_data = NULL; #endif unicsv_waypt_ct++; @@ -1536,7 +1536,7 @@ unicsv_waypt_disp_cb(const waypoint *wpt) break; case grid_lat_lon_dms: { - char *sep, *tmp; + char* sep, *tmp; cout = pretty_deg_format(lat, lon, 's', unicsv_fieldsep, 0); sep = strchr(cout, ','); *sep = '\0'; @@ -1653,7 +1653,7 @@ unicsv_waypt_disp_cb(const waypoint *wpt) } } if FIELD_USED(fld_fix) { - const char *fix; + const char* fix; switch (wpt->fix) { case fix_none: fix = "none"; @@ -1922,7 +1922,7 @@ unicsv_waypt_disp_cb(const waypoint *wpt) static void -unicsv_wr_init(const char *filename) +unicsv_wr_init(const char* filename) { fout = gbfopen(filename, "wb", MYNAME); diff --git a/gpsbabel/units.cc b/gpsbabel/units.cc index 0bd1312a0..716a0a1b6 100644 --- a/gpsbabel/units.cc +++ b/gpsbabel/units.cc @@ -39,7 +39,7 @@ fmt_setunits(fmt_units u) } double -fmt_distance(const double distance_meters, const char **tag) +fmt_distance(const double distance_meters, const char** tag) { double d; @@ -77,7 +77,7 @@ fmt_distance(const double distance_meters, const char **tag) } double -fmt_altitude(const double distance_meters, const char **tag) +fmt_altitude(const double distance_meters, const char** tag) { double d; @@ -105,7 +105,7 @@ fmt_altitude(const double distance_meters, const char **tag) } double -fmt_speed(const double distance_meters_sec, const char **tag) +fmt_speed(const double distance_meters_sec, const char** tag) { double d; diff --git a/gpsbabel/util.cc b/gpsbabel/util.cc index a75523c84..cd20a1bde 100644 --- a/gpsbabel/util.cc +++ b/gpsbabel/util.cc @@ -45,7 +45,7 @@ #ifdef DEBUG_MEM #define DEBUG_FILENAME "/tmp/gpsbabel.debug" -static FILE *debug_mem_file = NULL; +static FILE* debug_mem_file = NULL; void debug_mem_open() { @@ -53,7 +53,7 @@ debug_mem_open() } void -debug_mem_output(char *format, ...) +debug_mem_output(char* format, ...) { va_list args; va_start(args, format); @@ -74,14 +74,14 @@ debug_mem_close() } #endif -void * +void* #ifdef DEBUG_MEM XMALLOC(size_t size, DEBUG_PARAMS) #else xmalloc(size_t size) #endif { - void *obj = malloc(size); + void* obj = malloc(size); #ifdef DEBUG_MEM debug_mem_output("malloc, %x, %d, %s, %d\n", @@ -94,14 +94,14 @@ xmalloc(size_t size) return obj; } -void * +void* #ifdef DEBUG_MEM XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS) #else xcalloc(size_t nmemb, size_t size) #endif { - void *obj = calloc(nmemb, size); + void* obj = calloc(nmemb, size); #ifdef DEBUG_MEM debug_mem_output("calloc, %x, %d, %d, %s, %d\n", obj, nmemb, size, file, line); @@ -116,26 +116,26 @@ xcalloc(size_t nmemb, size_t size) void #ifdef DEBUG_MEM -XFREE(const void *mem, DEBUG_PARAMS) +XFREE(const void* mem, DEBUG_PARAMS) #else -xfree(const void *mem) +xfree(const void* mem) #endif { - free((void *) mem); + free((void*) mem); #ifdef DEBUG_MEM debug_mem_output("free, %x, %s, %d\n", mem, file, line); #endif } -char * +char* #ifdef DEBUG_MEM -XSTRDUP(const char *s, DEBUG_PARAMS) +XSTRDUP(const char* s, DEBUG_PARAMS) #else -xstrdup(const char *s) +xstrdup(const char* s) #endif { - char *o = s ? strdup(s) : strdup(""); + char* o = s ? strdup(s) : strdup(""); #ifdef DEBUG_MEM debug_mem_output("strdup, %x, %x, %s, %d\n", o, s, file, line); @@ -151,23 +151,23 @@ xstrdup(const char *s) /* * Duplicate at most sz bytes in str. */ -char * +char* #ifdef DEBUG_MEM -XSTRNDUP(const char *str, size_t sz, DEBUG_PARAMS) +XSTRNDUP(const char* str, size_t sz, DEBUG_PARAMS) #else -xstrndup(const char *str, size_t sz) +xstrndup(const char* str, size_t sz) #endif { size_t newlen = 0; - char *cin = (char *)str; - char *newstr; + char* cin = (char*)str; + char* newstr; while ((newlen < sz) && (*cin != '\0')) { newlen++; cin++; } - newstr = (char *) xmalloc(newlen + 1); + newstr = (char*) xmalloc(newlen + 1); memcpy(newstr, str, newlen); newstr[newlen] = 0; @@ -178,23 +178,23 @@ xstrndup(const char *str, size_t sz) * Lazily trim whitespace (though not from allocated version) * while copying. */ -char * +char* #ifdef DEBUG_MEM -XSTRNDUPT(const char *str, size_t sz, DEBUG_PARAMS) +XSTRNDUPT(const char* str, size_t sz, DEBUG_PARAMS) #else -xstrndupt(const char *str, size_t sz) +xstrndupt(const char* str, size_t sz) #endif { size_t newlen = 0; - char *cin = (char *)str; - char *newstr; + char* cin = (char*)str; + char* newstr; while ((newlen < sz) && (*cin != '\0')) { newlen++; cin++; } - newstr = (char *) xmalloc(newlen + 1); + newstr = (char*) xmalloc(newlen + 1); memcpy(newstr, str, newlen); newstr[newlen] = 0; rtrim(newstr); @@ -202,14 +202,14 @@ xstrndupt(const char *str, size_t sz) return newstr; } -void * +void* #ifdef DEBUG_MEM -XREALLOC(void *p, size_t s, DEBUG_PARAMS) +XREALLOC(void* p, size_t s, DEBUG_PARAMS) #else -xrealloc(void *p, size_t s) +xrealloc(void* p, size_t s) #endif { - char *o = (char *) realloc(p,s); + char* o = (char*) realloc(p,s); #ifdef DEBUG_MEM if (p != NULL) { debug_mem_output("realloc, %x, %x, %x, %s, %d\n", o, p, s, file, line); @@ -228,11 +228,11 @@ xrealloc(void *p, size_t s) /* * For an allocated string, realloc it and append 's' */ -char * +char* #ifdef DEBUG_MEM -XSTRAPPEND(char *src, const char *newd, DEBUG_PARAMS) +XSTRAPPEND(char* src, const char* newd, DEBUG_PARAMS) #else -xstrappend(char *src, const char *newd) +xstrappend(char* src, const char* newd) #endif { size_t newsz; @@ -245,7 +245,7 @@ xstrappend(char *src, const char *newd) } newsz = strlen(src) + strlen(newd) + 1; - src = (char *) xxrealloc(src, newsz, file, line); + src = (char*) xxrealloc(src, newsz, file, line); strcat(src, newd); return src; @@ -254,10 +254,10 @@ xstrappend(char *src, const char *newd) /* * Wrapper for open that honours - for stdin, stdout, unifies error text. */ -FILE * -xfopen(const char *fname, const char *type, const char *errtxt) +FILE* +xfopen(const char* fname, const char* type, const char* errtxt) { - FILE *f; + FILE* f; int am_writing = strchr(type, 'w') != NULL; if (fname == NULL) { @@ -288,7 +288,7 @@ xfopen(const char *fname, const char *type, const char *errtxt) */ int -xasprintf(char **strp, const char *fmt, ...) +xasprintf(char** strp, const char* fmt, ...) { va_list args; int res; @@ -301,7 +301,7 @@ xasprintf(char **strp, const char *fmt, ...) } int -xvasprintf(char **strp, const char *fmt, va_list ap) +xvasprintf(char** strp, const char* fmt, va_list ap) { /* From http://perfec.to/vsnprintf/pasprintf.c */ /* size of first buffer malloc; start small to exercise grow routines */ @@ -310,9 +310,9 @@ xvasprintf(char **strp, const char *fmt, va_list ap) #else # define FIRSTSIZE 1 #endif - char *buf = NULL; + char* buf = NULL; int bufsize; - char *newbuf; + char* newbuf; size_t nextsize = 0; int outsize; va_list args; @@ -320,12 +320,12 @@ xvasprintf(char **strp, const char *fmt, va_list ap) bufsize = 0; for (;;) { if (bufsize == 0) { - if ((buf = (char *) xmalloc(FIRSTSIZE)) == NULL) { + if ((buf = (char*) xmalloc(FIRSTSIZE)) == NULL) { *strp = NULL; return -1; } bufsize = FIRSTSIZE; - } else if ((newbuf = (char *) xrealloc(buf, nextsize)) != NULL) { + } else if ((newbuf = (char*) xrealloc(buf, nextsize)) != NULL) { buf = newbuf; bufsize = nextsize; } else { @@ -379,7 +379,7 @@ xvasprintf(char **strp, const char *fmt, va_list ap) if (bufsize > outsize + 1) { const unsigned ptrsz = sizeof(buf); if (((bufsize + ptrsz + 1) / ptrsz) > ((outsize + ptrsz + 1) / ptrsz)) { - buf = (char *) xrealloc(buf, outsize + 1); + buf = (char*) xrealloc(buf, outsize + 1); } } @@ -388,9 +388,9 @@ xvasprintf(char **strp, const char *fmt, va_list ap) } void -rtrim(char *s) +rtrim(char* s) { - char *t = s; + char* t = s; if (!s || !*s) { return; @@ -410,10 +410,10 @@ rtrim(char *s) /* * Like trim, but trims whitespace from both beginning and end. */ -char * -lrtrim(char *buff) +char* +lrtrim(char* buff) { - char *c; + char* c; if (buff[0] == '\0') { return buff; @@ -430,8 +430,8 @@ lrtrim(char *buff) } if (c != buff) { - char *src = c; - char *dst = buff; + char* src = c; + char* dst = buff; while (*src) { *dst++ = *src++; @@ -447,7 +447,7 @@ lrtrim(char *buff) */ int -case_ignore_strcmp(const char *s1, const char *s2) +case_ignore_strcmp(const char* s1, const char* s2) { for (; toupper(*s1) == toupper(*s2); ++ s1, ++s2) { if (*s1 == 0) { @@ -459,7 +459,7 @@ case_ignore_strcmp(const char *s1, const char *s2) } int -case_ignore_strncmp(const char *s1, const char *s2, int n) +case_ignore_strncmp(const char* s1, const char* s2, int n) { int rv = 0; @@ -484,12 +484,12 @@ case_ignore_strncmp(const char *s1, const char *s2, int n) */ int -str_match(const char *str, const char *match) +str_match(const char* str, const char* match) { - char *m, *s; + char* m, *s; - s = (char *)str; - m = (char *)match; + s = (char*)str; + m = (char*)match; while (*m || *s) { switch (*m) { @@ -515,7 +515,7 @@ str_match(const char *str, const char *match) } do { - char *mx, *sx; + char* mx, *sx; while (*s && (*s != *m)) { s++; @@ -588,9 +588,9 @@ str_match(const char *str, const char *match) */ int -case_ignore_str_match(const char *str, const char *match) +case_ignore_str_match(const char* str, const char* match) { - char *s1, *s2; + char* s1, *s2; int res; s1 = strupper(xstrdup(str)); @@ -602,22 +602,22 @@ case_ignore_str_match(const char *str, const char *match) return res; } -char * -strenquote(const char *str, const char quot_char) +char* +strenquote(const char* str, const char quot_char) { int len; - const char *cin; - char *cout; - char *tmp; + const char* cin; + char* cout; + char* tmp; if (str == NULL) { cin = ""; } else { - cin = (char *)str; + cin = (char*)str; } len = strlen(cin); - cout = tmp = (char *) xmalloc((len * 2) + 3); + cout = tmp = (char*) xmalloc((len * 2) + 3); *cout++ = quot_char; while (*cin) { @@ -655,7 +655,7 @@ printposn(const double c, int is_lat) } void -is_fatal(const int condition, const char *fmt, ...) +is_fatal(const int condition, const char* fmt, ...) { va_list args; char buff[128]; @@ -675,39 +675,39 @@ is_fatal(const int condition, const char *fmt, ...) * Read 4 bytes in big-endian. Return as "int" in native endianness. */ signed int -be_read32(const void *p) +be_read32(const void* p) { - unsigned char *i = (unsigned char *) p; + unsigned char* i = (unsigned char*) p; return i[0] << 24 | i[1] << 16 | i[2] << 8 | i[3]; } signed int -be_read16(const void *p) +be_read16(const void* p) { - unsigned char *i = (unsigned char *) p; + unsigned char* i = (unsigned char*) p; return i[0] << 8 | i[1]; } unsigned int -be_readu16(const void *p) +be_readu16(const void* p) { - const unsigned char *i = (unsigned char *) p; + const unsigned char* i = (unsigned char*) p; return i[0] << 8 | i[1]; } void -be_write16(void *addr, const unsigned value) +be_write16(void* addr, const unsigned value) { - unsigned char *p = (unsigned char *) addr; + unsigned char* p = (unsigned char*) addr; p[0] = value >> 8; p[1] = value; } void -be_write32(void *pp, const unsigned i) +be_write32(void* pp, const unsigned i) { - char *p = (char *)pp; + char* p = (char*)pp; p[0] = (i >> 24) & 0xff; p[1] = (i >> 16) & 0xff; @@ -716,30 +716,30 @@ be_write32(void *pp, const unsigned i) } signed int -le_read16(const void *addr) +le_read16(const void* addr) { - const unsigned char *p = (const unsigned char *) addr; + const unsigned char* p = (const unsigned char*) addr; return p[0] | (p[1] << 8); } unsigned int -le_readu16(const void *addr) +le_readu16(const void* addr) { - const unsigned char *p = (const unsigned char *) addr; + const unsigned char* p = (const unsigned char*) addr; return p[0] | (p[1] << 8); } signed int -le_read32(const void *addr) +le_read32(const void* addr) { - const unsigned char *p = (const unsigned char *) addr; + const unsigned char* p = (const unsigned char*) addr; return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); } unsigned int -le_readu32(const void *addr) +le_readu32(const void* addr) { - const unsigned char *p = (const unsigned char *) addr; + const unsigned char* p = (const unsigned char*) addr; return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); } @@ -748,10 +748,10 @@ le_readu32(const void *addr) * in host endianness. */ void -le_read64(void *dest, const void *src) +le_read64(void* dest, const void* src) { - char *cdest = (char *) dest; - const char *csrc = (const char *) src; + char* cdest = (char*) dest; + const char* csrc = (const char*) src; if (i_am_little_endian) { memcpy(dest, src, 8); @@ -764,18 +764,18 @@ le_read64(void *dest, const void *src) } void -le_write16(void *addr, const unsigned value) +le_write16(void* addr, const unsigned value) { - unsigned char *p = (unsigned char *) addr; + unsigned char* p = (unsigned char*) addr; p[0] = value; p[1] = value >> 8; } void -le_write32(void *addr, const unsigned value) +le_write32(void* addr, const unsigned value) { - unsigned char *p = (unsigned char *) addr; + unsigned char* p = (unsigned char*) addr; p[0] = value; p[1] = value >> 8; p[2] = value >> 16; @@ -807,7 +807,7 @@ si_round(double d) */ time_t -mkgmtime(struct tm *t) +mkgmtime(struct tm* t) { short month, year; time_t result; @@ -844,7 +844,7 @@ mkgmtime(struct tm *t) * which is evaluated by mktime */ time_t -mklocaltime(struct tm *t) +mklocaltime(struct tm* t) { time_t result; struct tm check = *t; @@ -881,13 +881,13 @@ current_time(void) * Return the (zero based) month number of the year or -1 for failure. */ signed int -month_lookup(const char *m) +month_lookup(const char* m) { - static const char *months[] = { + static const char* months[] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", NULL }; - const char **mp; + const char** mp; for (mp = months; *mp; mp++) { if (0 == case_ignore_strcmp(*mp, m)) { @@ -904,7 +904,7 @@ month_lookup(const char *m) * that interesting to us anyway. */ #define EPOCH_TICKS 621355968000000000.0 -void dotnet_time_to_time_t(double dotnet, time_t *t, int *millisecs) +void dotnet_time_to_time_t(double dotnet, time_t* t, int* millisecs) { // TODO: replace this with better interface with normal return values // and called via a QDateTime. @@ -924,8 +924,8 @@ void dotnet_time_to_time_t(double dotnet, time_t *t, int *millisecs) * a GPX file from geocaching.com. Thus we sort of make all the other * formats do lookups based on these strings. */ -const char * -get_cache_icon(const waypoint *waypointp) +const char* +get_cache_icon(const waypoint* waypointp) { if (!global_opts.smart_icons) { return NULL; @@ -970,7 +970,7 @@ endian_read_double(const void* ptr, int read_le) { double ret; char r[8]; - const void *p; + const void* p; int i; if (i_am_little_endian == read_le) { @@ -985,7 +985,7 @@ endian_read_double(const void* ptr, int read_le) // Word order is different on arm, but not on arm-eabi. #if defined(__arm__) && !defined(__ARM_EABI__) memcpy(&ret, p + 4, 4); - memcpy(((void *)&ret) + 4, p, 4); + memcpy(((void*)&ret) + 4, p, 4); #else memcpy(&ret, p, 8); #endif @@ -998,7 +998,7 @@ endian_read_float(const void* ptr, int read_le) { float ret; char r[4]; - const void *p; + const void* p; int i; if (i_am_little_endian == read_le) { @@ -1018,14 +1018,14 @@ void endian_write_double(void* ptr, double d, int write_le) { int i; - char *optr = (char *) ptr; + char* optr = (char*) ptr; // Word order is different on arm, but not on arm-eabi. #if defined(__arm__) && !defined(__ARM_EABI__) char r[8]; memcpy(r + 4, &d, 4); - memcpy(r, ((void *)&d) + 4, 4); + memcpy(r, ((void*)&d) + 4, 4); #else - char *r = (char *)(void *)&d; + char* r = (char*)(void*)&d; #endif @@ -1041,9 +1041,9 @@ endian_write_double(void* ptr, double d, int write_le) void endian_write_float(void* ptr, float f, int write_le) { - char *r = (char *)(void *)&f; + char* r = (char*)(void*)&f; int i; - char *optr = (char *) ptr; + char* optr = (char*) ptr; if (i_am_little_endian == write_le) { memcpy(ptr, &f, 4); @@ -1055,49 +1055,49 @@ endian_write_float(void* ptr, float f, int write_le) } float -le_read_float(const void *ptr) +le_read_float(const void* ptr) { return endian_read_float(ptr, 1); } void -le_write_float(void *ptr, float f) +le_write_float(void* ptr, float f) { endian_write_float(ptr,f,1); } float -be_read_float(void *ptr) +be_read_float(void* ptr) { return endian_read_float(ptr, 0); } void -be_write_float(void *ptr, float f) +be_write_float(void* ptr, float f) { endian_write_float(ptr,f,0); } double -le_read_double(const void *ptr) +le_read_double(const void* ptr) { return endian_read_double(ptr,1); } void -le_write_double(void *ptr, double d) +le_write_double(void* ptr, double d) { endian_write_double(ptr,d,1); } double -be_read_double(void *ptr) +be_read_double(void* ptr) { return endian_read_double(ptr,0); } void -be_write_double(void *ptr, double d) +be_write_double(void* ptr, double d) { endian_write_double(ptr,d,0); } @@ -1125,21 +1125,21 @@ double degrees2ddmm(double deg_val) * Returns an allocated copy if substitution was made, otherwise returns NULL. * Doesn't try to make an optimally sized dest buffer. */ -char * -strsub(const char *s, const char *search, const char *replace) +char* +strsub(const char* s, const char* search, const char* replace) { - const char *p; + const char* p; int len = strlen(s); int slen = strlen(search); int rlen = strlen(replace); - char *d; + char* d; p = strstr(s, search); if (!slen || !p) { return NULL; } - d = (char *) xmalloc(len + rlen); + d = (char*) xmalloc(len + rlen); /* Copy first part */ len = p - s; @@ -1157,21 +1157,21 @@ strsub(const char *s, const char *search, const char *replace) /* * As strsub, but do it globally. */ -char * -gstrsub(const char *s, const char *search, const char *replace) +char* +gstrsub(const char* s, const char* search, const char* replace) { int ooffs = 0; - char *o, *c; - char *src = (char *)s; + char* o, *c; + char* src = (char*)s; int olen = strlen(src); int slen = strlen(search); int rlen = strlen(replace); - o = (char *) xmalloc(olen + 1); + o = (char*) xmalloc(olen + 1); while ((c = strstr(src, search))) { olen += (rlen - slen); - o = (char *) xrealloc(o, olen + 1); + o = (char*) xrealloc(o, olen + 1); memcpy(o + ooffs, src, c - src); ooffs += (c - src); src = c + slen; @@ -1191,10 +1191,10 @@ gstrsub(const char *s, const char *search, const char *replace) /* * Like strstr, but starts from back of string. */ -const char * -xstrrstr(const char *s1, const char *s2) +const char* +xstrrstr(const char* s1, const char* s2) { - const char *r = NULL, *next = NULL; + const char* r = NULL, *next = NULL; while (next = strstr(s1, s2), NULL != next) { r = next; @@ -1206,10 +1206,10 @@ xstrrstr(const char *s1, const char *s2) /* * */ -char * -strupper(char *src) +char* +strupper(char* src) { - char *c; + char* c; for (c = src; *c; c++) { *c = toupper(*c); @@ -1220,10 +1220,10 @@ strupper(char *src) /* * */ -char * -strlower(char *src) +char* +strlower(char* src) { - char *c; + char* c; for (c = src; *c; c++) { *c = tolower(*c); @@ -1231,11 +1231,11 @@ strlower(char *src) return src; } -char * +char* rot13(const QString& s) { - char *result = xstrdup(s.toUtf8().data()); - char *cur = result; + char* result = xstrdup(s.toUtf8().data()); + char* cur = result; int flip = 1; while (cur && *cur) { if (flip) { @@ -1259,19 +1259,19 @@ rot13(const QString& s) * a format usable for strftime and others */ -char * -convert_human_date_format(const char *human_datef) +char* +convert_human_date_format(const char* human_datef) { - char *result, *cin, *cout; + char* result, *cin, *cout; char prev; int ylen; - result = (char *) xcalloc((2*strlen(human_datef)) + 1, 1); + result = (char*) xcalloc((2*strlen(human_datef)) + 1, 1); cout = result; prev = '\0'; ylen = 0; - for (cin = (char *)human_datef; *cin; cin++) { + for (cin = (char*)human_datef; *cin; cin++) { char okay = 1; if (toupper(*cin) != 'Y') { @@ -1327,17 +1327,17 @@ convert_human_date_format(const char *human_datef) * a format usable for strftime and others */ -char * -convert_human_time_format(const char *human_timef) +char* +convert_human_time_format(const char* human_timef) { - char *result, *cin, *cout; + char* result, *cin, *cout; char prev; - result = (char *) xcalloc((2*strlen(human_timef)) + 1, 1); + result = (char*) xcalloc((2*strlen(human_timef)) + 1, 1); cout = result; prev = '\0'; - for (cin = (char *)human_timef; *cin; cin++) { + for (cin = (char*)human_timef; *cin; cin++) { int okay = 1; if (isalpha(*cin)) { @@ -1423,13 +1423,13 @@ convert_human_time_format(const char *human_timef) * sep = string between lat and lon (separator) * html = 1 for html output otherwise text */ -char * -pretty_deg_format(double lat, double lon, char fmt, const char *sep, int html) +char* +pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html) { double latmin, lonmin, latsec, lonsec; int latint, lonint; char latsig, lonsig; - char *result; + char* result; latsig = lat < 0 ? 'S':'N'; lonsig = lon < 0 ? 'W':'E'; latint = abs((int) lat); @@ -1466,11 +1466,11 @@ pretty_deg_format(double lat, double lon, char fmt, const char *sep, int html) * and - stop processing altogether * - stop overriding styles for everything */ -char * +char* strip_nastyhtml(const QString& in) { - char *returnstr, *sp; - char *lcstr, *lcp; + char* returnstr, *sp; + char* lcstr, *lcp; sp = returnstr = xstrdup(in.toUtf8().data()); lcp = lcstr = strlower(xstrdup(in.toUtf8().data())); @@ -1557,8 +1557,8 @@ strip_nastyhtml(const QString& in) * pleasant for a human reader. Yes, this falls down in all kinds of * ways such as spaces within the tags, etc. */ -char * -strip_html(const utf_string *in) +char* +strip_html(const utf_string* in) { char* outstring, *out; char* incopy, *instr; @@ -1572,7 +1572,7 @@ strip_html(const utf_string *in) /* * We only shorten, so just dupe the input buf for space. */ - outstring = out = xstrdup(CSTR(in->utfstring)); + outstring = out = xstrdup(CSTR(in->utfstring)); tag[0] = 0; while (*instr) { @@ -1642,8 +1642,8 @@ strip_html(const utf_string *in) } typedef struct { - const char * text; - const char * entity; + const char* text; + const char* entity; int not_html; } entity_types; @@ -1689,13 +1689,13 @@ entity_types stdentities[] = { }; static -char * -entitize(const char * str, int is_html) +char* +entitize(const char* str, int is_html) { int elen, ecount, nsecount; - entity_types *ep; - const char * cp; - char * p, * tmp, * xstr; + entity_types* ep; + const char* cp; + char* p, * tmp, * xstr; int bytes = 0; int value = 0; @@ -1728,7 +1728,7 @@ entitize(const char * str, int is_html) #endif /* enough space for the whole string plus entity replacements, if any */ - tmp = (char *) xcalloc((strlen(str) + elen + 1), 1); + tmp = (char*) xcalloc((strlen(str) + elen + 1), 1); strcpy(tmp, str); /* no entity replacements */ @@ -1785,12 +1785,12 @@ entitize(const char * str, int is_html) * Public callers for the above to hide the absence of &apos from HTML */ -char * xml_entitize(const char * str) +char* xml_entitize(const char* str) { return entitize(str, 0); } -char * html_entitize(const char * str) +char* html_entitize(const char* str) { return entitize(str, 1); } @@ -1799,7 +1799,7 @@ char * html_entitize(const char * str) * xml_tag utilities */ -xml_tag *xml_next(xml_tag *root, xml_tag *cur) +xml_tag* xml_next(xml_tag* root, xml_tag* cur) { if (cur->child) { cur = cur->child; @@ -1817,25 +1817,25 @@ xml_tag *xml_next(xml_tag *root, xml_tag *cur) return cur; } -xml_tag *xml_findnext(xml_tag *root, xml_tag *cur, const char *tagname) +xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname) { - xml_tag *result = cur; + xml_tag* result = cur; do { result = xml_next(root, result); } while (result && case_ignore_strcmp(result->tagname, tagname)); return result; } -xml_tag *xml_findfirst(xml_tag *root, const char *tagname) +xml_tag* xml_findfirst(xml_tag* root, const char* tagname) { return xml_findnext(root, root, tagname); } -char *xml_attribute(xml_tag *tag, const char *attrname) +char* xml_attribute(xml_tag* tag, const char* attrname) { - char *result = NULL; + char* result = NULL; if (tag->attributes) { - char **attr = tag->attributes; + char** attr = tag->attributes; while (attr && *attr) { if (0 == case_ignore_strcmp(*attr, attrname)) { result = attr[1]; @@ -1847,11 +1847,11 @@ char *xml_attribute(xml_tag *tag, const char *attrname) return result; } -const char *get_filename(const char *fname) +const char* get_filename(const char* fname) { - const char *res; - const char *cb; - const char *cs; + const char* res; + const char* cb; + const char* cs; cb = strrchr(fname, '\\'); cs = strrchr(fname, '/'); @@ -1864,7 +1864,7 @@ const char *get_filename(const char *fname) res = (cs > cb) ? cs : cb; } - return (res == NULL) ? (char *) fname : ++res; + return (res == NULL) ? (char*) fname : ++res; } /* bit manipulation functions */ @@ -1872,18 +1872,18 @@ const char *get_filename(const char *fname) /* * setbit: Set bit number [nr] of buffer [buf] */ -void gb_setbit(void *buf, const uint32_t nr) +void gb_setbit(void* buf, const uint32_t nr) { - unsigned char *bytes = (unsigned char *) buf; + unsigned char* bytes = (unsigned char*) buf; bytes[nr / 8] |= (1 << (nr % 8)); } /* * setbit: Get state of bit number [nr] of buffer [buf] */ -char gb_getbit(const void *buf, const uint32_t nr) +char gb_getbit(const void* buf, const uint32_t nr) { - const unsigned char *bytes = (const unsigned char *) buf; + const unsigned char* bytes = (const unsigned char*) buf; return (bytes[nr / 8] & (1 << (nr % 8))); } @@ -1891,10 +1891,10 @@ char gb_getbit(const void *buf, const uint32_t nr) /* * gb_int2ptr: Needed, when sizeof(*void) != sizeof(int) ! compiler warning ! */ -void *gb_int2ptr(const int i) +void* gb_int2ptr(const int i) { union { - void *p; + void* p; int i; } x = { NULL }; @@ -1905,10 +1905,10 @@ void *gb_int2ptr(const int i) /* * gb_ptr2int: Needed, when sizeof(*void) != sizeof(int) ! compiler warning ! */ -int gb_ptr2int(const void *p) +int gb_ptr2int(const void* p) { union { - const void *p; + const void* p; int i; } x = { p }; diff --git a/gpsbabel/util_crc.cc b/gpsbabel/util_crc.cc index 4e91871d2..1fd5a431a 100644 --- a/gpsbabel/util_crc.cc +++ b/gpsbabel/util_crc.cc @@ -66,12 +66,12 @@ static unsigned long crc32_table[256] = { }; unsigned long -get_crc32(const void * data, int datalen) +get_crc32(const void* data, int datalen) { unsigned long crc = 0xFFFFFFFF; - const unsigned char * cp = (unsigned char *)data; + const unsigned char* cp = (unsigned char*)data; - while (cp < ((unsigned char *)data + datalen)) { + while (cp < ((unsigned char*)data + datalen)) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32_table[(crc ^ *cp) &0xFF]; cp++; } @@ -83,10 +83,10 @@ get_crc32(const void * data, int datalen) * As above, but on null-terminated string. */ unsigned long -get_crc32_s(const void *data) +get_crc32_s(const void* data) { unsigned long crc = 0xFFFFFFFF; - const unsigned char* cp = (unsigned char *)data; + const unsigned char* cp = (unsigned char*)data; for (; *cp; cp++) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32_table[(crc ^ *cp) &0xFF]; diff --git a/gpsbabel/uuid.cc b/gpsbabel/uuid.cc index 9ad956fb4..d4c01c629 100644 --- a/gpsbabel/uuid.cc +++ b/gpsbabel/uuid.cc @@ -23,7 +23,7 @@ void gb_uuid_generate(uuid_t uu) { - unsigned char *cp; + unsigned char* cp; int i; for (cp = uu, i = 0; i < 16; i++) { if (getenv("GPSBABEL_FREEZE_TIME")) { diff --git a/gpsbabel/v900.cc b/gpsbabel/v900.cc index 24d8533cf..9d8c19c96 100644 --- a/gpsbabel/v900.cc +++ b/gpsbabel/v900.cc @@ -144,7 +144,7 @@ static FILE* fin = NULL; /* copied from dg-100.cpp */ static void -v900_log(const char *fmt, ...) +v900_log(const char* fmt, ...) { va_list ap; @@ -158,7 +158,7 @@ v900_log(const char *fmt, ...) } static void -v900_rd_init(const char *fname) +v900_rd_init(const char* fname) { v900_log("%s(%s)\n",__func__,fname); /* note: file is opened in binary mode, since lines end with \r\n, and in windows text mode @@ -217,7 +217,7 @@ v900_read(void) } line; int is_advanced_mode = 0; int lc = 0; - route_head *track; + route_head* track; v900_log("%s\n",__func__); @@ -241,7 +241,7 @@ v900_read(void) track_add_head(track); while (1) { - waypoint *wpt; + waypoint* wpt; char c; int bad = 0; int record_len = is_advanced_mode ? sizeof(line.adv) : sizeof(line.bas); @@ -356,7 +356,7 @@ v900_read(void) track_add_wpt(track, wpt); if (line.bas.common.tag != 'T') { - waypoint *wpt2; + waypoint* wpt2; // A 'G' tag appears to be a 'T' tag, but generated on the trailing // edge of a DGPS fix as it decays to an SPS fix. See 1/13/13 email // thread on gpsbabel-misc with Jamie Robertson. @@ -365,7 +365,7 @@ v900_read(void) wpt2 = waypt_dupe(wpt); if (line.bas.common.tag == 'V') { // waypoint with voice recording? char vox_file_name[sizeof(line.adv.vox)+5]; - const char *vox = is_advanced_mode ? line.adv.vox : line.bas.vox; + const char* vox = is_advanced_mode ? line.adv.vox : line.bas.vox; assert(vox[0] != '\0'); strcpy(vox_file_name,vox); strcat(vox_file_name,".WAV"); diff --git a/gpsbabel/vcf.cc b/gpsbabel/vcf.cc index 65ab611ac..977d9cd16 100644 --- a/gpsbabel/vcf.cc +++ b/gpsbabel/vcf.cc @@ -25,10 +25,10 @@ #include "defs.h" #include "jeeps/gpsmath.h" -static gbfile *file_out; +static gbfile* file_out; static short_handle mkshort_handle; -static char *vcf_encrypt = NULL; +static char* vcf_encrypt = NULL; #define MYNAME "VCF" @@ -42,7 +42,7 @@ arglist_t vcf_args[] = { }; static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -60,10 +60,10 @@ wr_deinit(void) * newlines as we go. */ static void -vcf_print_utf(const utf_string *s) +vcf_print_utf(const utf_string* s) { - char *p, *p2, *p3; - char *stripped_html; + char* p, *p2, *p3; + char* stripped_html; if (!s) { return; @@ -81,9 +81,9 @@ vcf_print_utf(const utf_string *s) } static void -vcf_print(const char *s) +vcf_print(const char* s) { - char *p; + char* p; if (!s) { return; @@ -95,7 +95,7 @@ vcf_print(const char *s) } static void -vcf_disp(const waypoint *wpt) +vcf_disp(const waypoint* wpt) { int latint, lonint; @@ -117,7 +117,7 @@ vcf_disp(const waypoint *wpt) vcf_print_utf(&wpt->gc_data->desc_long); gbfprintf(file_out, "\\n\\nHINT:\\n"); if (vcf_encrypt) { - char *s = rot13(wpt->gc_data->hint); + char* s = rot13(wpt->gc_data->hint); vcf_print(s); xfree(s); } else { diff --git a/gpsbabel/vecs.cc b/gpsbabel/vecs.cc index 64a00dbde..5a9b1e04e 100644 --- a/gpsbabel/vecs.cc +++ b/gpsbabel/vecs.cc @@ -28,11 +28,11 @@ #define MYNAME "vecs.c" typedef struct { - ff_vecs_t *vec; - const char *name; - const char *desc; - const char *extension; - const char *parent; + ff_vecs_t* vec; + const char* name; + const char* desc; + const char* extension; + const char* parent; } vecs_t; extern ff_vecs_t an1_vecs; @@ -965,9 +965,9 @@ vecs_t vec_list[] = { void init_vecs(void) { - vecs_t *vec = vec_list; + vecs_t* vec = vec_list; while (vec->vec) { - arglist_t *ap; + arglist_t* ap; if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { ap->argvalptr = NULL; @@ -981,7 +981,7 @@ init_vecs(void) } int -is_integer(const char *c) +is_integer(const char* c) { return isdigit(c[0]) || ((c[0] == '+' || c[0] == '-') && isdigit(c[1])); } @@ -989,9 +989,9 @@ is_integer(const char *c) void exit_vecs(void) { - vecs_t *vec = vec_list; + vecs_t* vec = vec_list; while (vec->vec) { - arglist_t *ap; + arglist_t* ap; if (vec->vec->exit) { (*vec->vec->exit)(); } @@ -1013,9 +1013,9 @@ exit_vecs(void) } void -assign_option(const char *module, arglist_t *ap, const char *val) +assign_option(const char* module, arglist_t* ap, const char* val) { - const char *c; + const char* c; if (ap->argval == NULL) { fatal("%s: No local variable defined for option \"%s\"!", module, ap->argstring); @@ -1036,7 +1036,7 @@ assign_option(const char *module, arglist_t *ap, const char *val) if (case_ignore_strcmp(val, ap->argstring) == 0) { c = ""; } else { - c = (char *)val; + c = (char*)val; } switch (ap->argtype & ARGTYPE_TYPEMASK) { @@ -1098,7 +1098,7 @@ assign_option(const char *module, arglist_t *ap, const char *val) } void -disp_vec_options(const char *vecname, arglist_t *ap) +disp_vec_options(const char* vecname, arglist_t* ap) { for (; ap && ap->argstring; ap++) { if (*ap->argval && ap->argval) { @@ -1112,13 +1112,13 @@ disp_vec_options(const char *vecname, arglist_t *ap) } } -ff_vecs_t * -find_vec(const char *vecname, const char **opts) +ff_vecs_t* +find_vec(const char* vecname, const char** opts) { - vecs_t *vec = vec_list; - style_vecs_t *svec = style_list; - char *v = xstrdup(vecname); - char *svecname = strtok(v, ","); + vecs_t* vec = vec_list; + style_vecs_t* svec = style_list; + char* v = xstrdup(vecname); + char* svecname = strtok(v, ","); int found = 0; if (vecname == NULL) { @@ -1140,14 +1140,14 @@ find_vec(const char *vecname, const char **opts) if (vec->vec->args) { for (arglist_t* ap = vec->vec->args; ap->argstring; ap++) { - const char *opt; + const char* opt; if (res) { opt = get_option(*opts, ap->argstring); if (opt) { found = 1; assign_option(svecname, ap, opt); - xfree((char *)opt); + xfree((char*)opt); continue; } } @@ -1197,14 +1197,14 @@ find_vec(const char *vecname, const char **opts) if (vec_list[0].vec->args) { for (arglist_t* ap = vec_list[0].vec->args; ap->argstring; ap++) { - const char *opt; + const char* opt; if (res) { opt = get_option(*opts, ap->argstring); if (opt) { found = 1; assign_option(svecname, ap, opt); - xfree((char *)opt); + xfree((char*)opt); continue; } } @@ -1246,18 +1246,18 @@ find_vec(const char *vecname, const char **opts) * Find and return a specific argument in an arg list. * Modelled approximately after getenv. */ -char * +char* #ifdef DEBUG_MEM -GET_OPTION(const char *iarglist, const char *argname, DEBUG_PARAMS) +GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS) #else -get_option(const char *iarglist, const char *argname) +get_option(const char* iarglist, const char* argname) #endif { size_t arglen = strlen(argname); - char *arglist; - char *rval = NULL; - char *arg; - char *argp; + char* arglist; + char* rval = NULL; + char* arg; + char* argp; if (!iarglist) { return NULL; @@ -1299,11 +1299,11 @@ get_option(const char *iarglist, const char *argname) * parse for help on available command line options. */ static signed int -alpha(const void *a, const void *b) +alpha(const void* a, const void* b) { - const vecs_t *const *ap = (const vecs_t *const*) a; - const vecs_t *const *bp = (const vecs_t *const*) b; + const vecs_t* const* ap = (const vecs_t *const*) a; + const vecs_t* const* bp = (const vecs_t *const*) b; return case_ignore_strcmp((*ap)->desc , (*bp)->desc); } @@ -1313,14 +1313,14 @@ alpha(const void *a, const void *b) * alphabetically. Returns an allocated copy of a style_vecs_array * that's populated and sorted. */ -vecs_t ** -sort_and_unify_vecs(int *ctp) +vecs_t** +sort_and_unify_vecs(int* ctp) { int vc; - vecs_t **svp; - vecs_t *vec; + vecs_t** svp; + vecs_t* vec; #if CSVFMTS_ENABLED - style_vecs_t *svec; + style_vecs_t* svec; #endif int i = 0; @@ -1334,7 +1334,7 @@ sort_and_unify_vecs(int *ctp) #endif // CSVFMTS_ENABLED - svp = (vecs_t **)xcalloc(vc, sizeof(style_vecs_t *)); + svp = (vecs_t**)xcalloc(vc, sizeof(style_vecs_t*)); /* Normal vecs are easy; populate the first part of the array. */ for (vec = vec_list; vec->vec; vec++, i++) { svp[i] = vec; @@ -1347,7 +1347,7 @@ sort_and_unify_vecs(int *ctp) /* Walk the style list, parse the entries, dummy up a "normal" vec */ for (svec = style_list; svec->name; svec++, i++) { xcsv_read_internal_style(svec->style_buf); - svp[i] = (vecs_t*) xcalloc(1, sizeof **svp); + svp[i] = (vecs_t*) xcalloc(1, sizeof** svp); svp[i]->name = svec->name; svp[i]->vec = (ff_vecs_t*) xmalloc(sizeof(*svp[i]->vec)); svp[i]->extension = xcsv_file.extension; @@ -1396,8 +1396,8 @@ sort_and_unify_vecs(int *ctp) void disp_vecs(void) { - vecs_t **svp; - arglist_t *ap; + vecs_t** svp; + arglist_t* ap; int vc; int i = 0; @@ -1422,10 +1422,10 @@ disp_vecs(void) } void -disp_vec(const char *vecname) +disp_vec(const char* vecname) { - vecs_t **svp; - arglist_t *ap; + vecs_t** svp; + arglist_t* ap; int vc; int i = 0; @@ -1456,7 +1456,7 @@ disp_vec(const char *vecname) static void disp_v1(ff_type t) { - const char *tstring; + const char* tstring; switch (t) { case ff_type_file: @@ -1476,7 +1476,7 @@ disp_v1(ff_type t) } static void -disp_v2(ff_vecs_t *v) +disp_v2(ff_vecs_t* v) { int i; for (i = 0; i < 3; i++) { @@ -1486,10 +1486,10 @@ disp_v2(ff_vecs_t *v) putchar('\t'); } -const char * +const char* name_option(long type) { - const char *at[] = { + const char* at[] = { "unknown", "integer", "float", @@ -1506,7 +1506,7 @@ name_option(long type) } static -void disp_help_url(const vecs_t *vec, arglist_t *arg) +void disp_help_url(const vecs_t* vec, arglist_t* arg) { printf("\t" WEB_DOC_DIR "/fmt_%s.html", vec->name); if (arg) { @@ -1517,9 +1517,9 @@ void disp_help_url(const vecs_t *vec, arglist_t *arg) static void -disp_v3(const vecs_t *vec) +disp_v3(const vecs_t* vec) { - arglist_t *ap; + arglist_t* ap; disp_help_url(vec, NULL); for (ap = vec->vec->args; ap && ap->argstring; ap++) { @@ -1546,8 +1546,8 @@ disp_v3(const vecs_t *vec) void disp_formats(int version) { - vecs_t **svp; - vecs_t *vec; + vecs_t** svp; + vecs_t* vec; int i, vc = 0; switch (version) { diff --git a/gpsbabel/vidaone.cc b/gpsbabel/vidaone.cc index 1d1c0a713..08e63249d 100644 --- a/gpsbabel/vidaone.cc +++ b/gpsbabel/vidaone.cc @@ -39,7 +39,7 @@ struct #define VIDAONE_VER "ver" -static char *vidaone_opt_ver; +static char* vidaone_opt_ver; static int vidaone_ver; static @@ -52,14 +52,14 @@ arglist_t vidaone_args[] = { ARG_TERMINATOR }; -static gbfile *fin, *fout; +static gbfile* fin, *fout; /******************************************************************************* * %%% global callbacks called by gpsbabel main process %%% * *******************************************************************************/ static void -vidaone_rd_init(const char *fname) +vidaone_rd_init(const char* fname) { vidaone_ver = atoi(vidaone_opt_ver); fin = gbfopen(fname, "rb", MYNAME); @@ -74,10 +74,10 @@ vidaone_rd_deinit(void) static void vidaone_read(void) { - route_head *trk = NULL; + route_head* trk = NULL; while (! gbfeof(fin)) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); @@ -101,7 +101,7 @@ vidaone_read(void) } static void -vidaone_wr_init(const char *fname) +vidaone_wr_init(const char* fname) { vidaone_ver = atoi(vidaone_opt_ver); fout = gbfopen(fname, "wb", MYNAME); @@ -114,7 +114,7 @@ vidaone_wr_deinit(void) } static void -vidaone_trkpt(const waypoint *wpt) +vidaone_trkpt(const waypoint* wpt) { gbfputdbl(wpt->latitude, fout); gbfputdbl(wpt->longitude, fout); diff --git a/gpsbabel/vitosmt.cc b/gpsbabel/vitosmt.cc index 1556331fc..f01cbaaef 100644 --- a/gpsbabel/vitosmt.cc +++ b/gpsbabel/vitosmt.cc @@ -29,8 +29,8 @@ #include "defs.h" #include "grtcirc.h" -static gbfile *infile =NULL; -static gbfile *ofs =NULL; +static gbfile* infile =NULL; +static gbfile* ofs =NULL; static long count =0; const long vitosmt_version =2; @@ -38,10 +38,10 @@ const long vitosmt_subversion =1000; const size_t vitosmt_headersize =24; const size_t vitosmt_datasize =64; -static unsigned char * -ReadRecord(gbfile *f, gbsize_t size) +static unsigned char* +ReadRecord(gbfile* f, gbsize_t size) { - unsigned char *result = (unsigned char *) xmalloc(size); + unsigned char* result = (unsigned char*) xmalloc(size); gbfread(result, size, 1, f); return result; @@ -57,7 +57,7 @@ WriteDouble(void* ptr, double d) static void -rd_init(const char *fname) +rd_init(const char* fname) { infile = gbfopen_le(fname, "rb", MYNAME); } @@ -76,8 +76,8 @@ vitosmt_read(void) long check1 =-1; long check2 =-2; long check3 =-3; - route_head *route_head =0; - waypoint *wpt_tmp =0; + route_head* route_head =0; + waypoint* wpt_tmp =0; double latrad =0; double lonrad =0; double elev =0; @@ -223,7 +223,7 @@ vitosmt_read(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { warning(MYNAME " write: format is experimental and may crash Vito Navigator II.\n"); ofs = gbfopen_le(fname, "wb", MYNAME); @@ -237,14 +237,14 @@ wr_deinit(void) } static void -vitosmt_waypt_pr(const waypoint *waypointp) +vitosmt_waypt_pr(const waypoint* waypointp) { - unsigned char * workbuffer =0; + unsigned char* workbuffer =0; size_t position =0; double seconds =0; ++count; - workbuffer = (unsigned char *) xcalloc(vitosmt_datasize,1); + workbuffer = (unsigned char*) xcalloc(vitosmt_datasize,1); WriteDouble(&workbuffer[position], RAD(waypointp->latitude)); position += sizeof(double); @@ -319,7 +319,7 @@ static void vitosmt_write(void) { time_t now = 0; - unsigned char * workbuffer =0; + unsigned char* workbuffer =0; size_t position =0; workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1); diff --git a/gpsbabel/vitovtt.cc b/gpsbabel/vitovtt.cc index a8eeae640..786a51d13 100644 --- a/gpsbabel/vitovtt.cc +++ b/gpsbabel/vitovtt.cc @@ -34,7 +34,7 @@ #define TM_YEAR_ZERO 1900 #define TM_MONTH_ZERO 1 -static gbfile *infile = 0; +static gbfile* infile = 0; static int count = 0; static const int vitovtt_version = 3; @@ -47,7 +47,7 @@ static const int vitovtt_secondscale = 30000000; static const int vitovtt_microsecondscale = 30; static void -rd_init(const char *fname) +rd_init(const char* fname) { infile = gbfopen_le(fname, "rb", MYNAME); } @@ -62,8 +62,8 @@ static void vitovtt_read(void) { int version = 0; - route_head *route_head = 0; - waypoint *wpt_tmp = 0; + route_head* route_head = 0; + waypoint* wpt_tmp = 0; int scaled_lat = 0; int scaled_lon = 0; double altitude = 0; diff --git a/gpsbabel/vmem.cc b/gpsbabel/vmem.cc index 64bb5673f..b20826636 100644 --- a/gpsbabel/vmem.cc +++ b/gpsbabel/vmem.cc @@ -31,16 +31,16 @@ vmem_alloc(size_t size, int flags) * By default, zero the allocated thingy. */ if (flags & VMFL_NOZERO) { - vm.mem = (char *) xmalloc(size); + vm.mem = (char*) xmalloc(size); } else { - vm.mem = (char *) xcalloc(size, 1); + vm.mem = (char*) xcalloc(size, 1); } vm.size = size; return vm; } void -vmem_free(vmem_t *vm) +vmem_free(vmem_t* vm) { if (vm->mem) { xfree(vm->mem); @@ -55,13 +55,13 @@ vmem_free(vmem_t *vm) * will only grow for a while then reach a steady state. */ void -vmem_realloc(vmem_t *vm, size_t size) +vmem_realloc(vmem_t* vm, size_t size) { /* * Reallocate only if we must. */ if (size > vm->size) { - vm->mem = (char *) xrealloc(vm->mem, size); + vm->mem = (char*) xrealloc(vm->mem, size); vm->size = size; } return; diff --git a/gpsbabel/vpl.cc b/gpsbabel/vpl.cc index b25c13644..6af30185f 100644 --- a/gpsbabel/vpl.cc +++ b/gpsbabel/vpl.cc @@ -119,15 +119,15 @@ arglist_t vpl_args[] = { ARG_TERMINATOR }; -static gbfile *vpl_file_in; -static route_head *track_head; +static gbfile* vpl_file_in; +static route_head* track_head; /******************************************************************************* * %%% global callbacks called by gpsbabel main process %%% * *******************************************************************************/ static void -vpl_rd_init(const char *fname) +vpl_rd_init(const char* fname) { vpl_file_in = gbfopen(fname, "r", MYNAME); } @@ -141,7 +141,7 @@ vpl_rd_deinit(void) static void vpl_read(void) { - char *ibuf; + char* ibuf; // Set up a track if (track_head == NULL) { @@ -157,7 +157,7 @@ vpl_read(void) } static void -vpl_wr_init(const char *fname) +vpl_wr_init(const char* fname) { fatal("Writing file of type %s is not support\n", MYNAME); } @@ -167,14 +167,14 @@ vpl_wr_init(const char *fname) *******************************************************************************/ void -vpl_parse_75_sentence(const char *ibuf) +vpl_parse_75_sentence(const char* ibuf) { uint32_t ymd, hms; int32_t lat_raw, lon_raw; int16_t alt, speed_raw; uint16_t hdg_raw; uint8_t sats, hdop_raw, vdop_raw; - waypoint *waypt; + waypoint* waypt; struct tm tm; // The files have DOS line endings (CR/LF) but we don't care, because we diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index e5650ce72..22f0e4f26 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -32,8 +32,8 @@ #if NEWQ QList waypt_list; -queue waypt_head; // This is here solely to freak out the formats that are - // looking into what should be a private members. +queue waypt_head; // This is here solely to freak out the formats that are +// looking into what should be a private members. #else queue waypt_head; #endif @@ -61,8 +61,8 @@ waypt_init(void) // This whole thing is a poor-man's copy constructor. It exists mostly // as a bridge from our non-reference counted C types to classes now. -waypoint * -waypt_dupe(const waypoint *wpt) +waypoint* +waypt_dupe(const waypoint* wpt) { /* * This and waypt_free should be closely synced. @@ -136,7 +136,7 @@ void update_common_traits(const waypoint* wpt) } void -waypt_add(waypoint *wpt) +waypt_add(waypoint* wpt) { double lat_orig = wpt->latitude; double lon_orig = wpt->longitude; @@ -201,7 +201,7 @@ waypt_add(waypoint *wpt) } void -waypt_del(waypoint *wpt) +waypt_del(waypoint* wpt) { dequeue(&wpt->Q); waypt_ct--; @@ -210,10 +210,10 @@ waypt_del(waypoint *wpt) /* * A constructor for a single waypoint. */ -waypoint * +waypoint* waypt_new(void) { - waypoint *wpt = new waypoint; + waypoint* wpt = new waypoint; #ifdef DEBUG_MEM wpt->altitude = unknown_alt; // should this be "latitude" instead of "altitude"? wpt->longitude = unknown_alt; @@ -241,7 +241,7 @@ set_waypt_count(unsigned int nc) } void -waypt_disp(const waypoint *wpt) +waypt_disp(const waypoint* wpt) { if (wpt->GetCreationTime().isValid()) { printf("%s ", qPrintable(wpt->creation_time.toString())); @@ -250,7 +250,7 @@ waypt_disp(const waypoint *wpt) printposn(wpt->longitude,0); if (wpt->description) { - char *tmpdesc = xstrdup(wpt->description); + char* tmpdesc = xstrdup(wpt->description); printf("%s/%s", global_opts.synthesize_shortnames ? mkshort(mkshort_handle, tmpdesc) : @@ -281,16 +281,16 @@ waypt_disp_all(waypt_cb cb) } void -waypt_disp_session(const session_t *se, waypt_cb cb) +waypt_disp_session(const session_t* se, waypt_cb cb) { int i = 0; #if NEWQ foreach(waypoint* waypointp, waypt_list) { #else - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; #endif if ((se == NULL) || (waypointp->session == se)) { if (global_opts.verbose_status) { @@ -306,7 +306,7 @@ waypt_disp_session(const session_t *se, waypt_cb cb) } void -waypt_init_bounds(bounds *bounds) +waypt_init_bounds(bounds* bounds) { /* Set data out of bounds so that even one waypoint will reset */ bounds->max_lat = -9999; @@ -318,7 +318,7 @@ waypt_init_bounds(bounds *bounds) } int -waypt_bounds_valid(bounds *bounds) +waypt_bounds_valid(bounds* bounds) { /* Returns true if bb has any 'real' data in it */ return bounds->max_lat > -9999; @@ -328,7 +328,7 @@ waypt_bounds_valid(bounds *bounds) * Recompund bounding box based on new position point. */ void -waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp) +waypt_add_to_bounds(bounds* bounds, const waypoint* waypointp) { if (waypointp->latitude > bounds->max_lat) { bounds->max_lat = waypointp->latitude; @@ -359,32 +359,32 @@ waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp) */ void -waypt_compute_bounds(bounds *bounds) +waypt_compute_bounds(bounds* bounds) { waypt_init_bounds(bounds); #if NEWQ foreach(waypoint* waypointp, waypt_list) { #else - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; #endif waypt_add_to_bounds(bounds, waypointp); } } -waypoint * -find_waypt_by_name(const char *name) +waypoint* +find_waypt_by_name(const char* name) { #if NEWQ foreach(waypoint* waypointp, waypt_list) { #else - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; #endif if (0 == strcmp(waypointp->shortname, name)) { return waypointp; @@ -395,7 +395,7 @@ find_waypt_by_name(const char *name) } void -waypt_free(waypoint *wpt) +waypt_free(waypoint* wpt) { /* * This and waypt_dupe should be closely synced. @@ -413,11 +413,11 @@ waypt_free(waypoint *wpt) #if 0 // these are now ref counted... if (wpt->url_next) { - url_link *url_next; + url_link* url_next; for (url_next = wpt->url_next; url_next;) { - url_link *tonuke = url_next; + url_link* tonuke = url_next; url_next = tonuke->url_next; xfree(tonuke); } @@ -425,7 +425,7 @@ waypt_free(waypoint *wpt) #endif if (wpt->gc_data != &empty_gc_data) { - geocache_data *gc_data = (geocache_data *)wpt->gc_data; + geocache_data* gc_data = (geocache_data*)wpt->gc_data; delete gc_data; } @@ -435,19 +435,20 @@ waypt_free(waypoint *wpt) #if NEWQ void -waypt_flush(queue* head) { +waypt_flush(queue* head) +{ while (!waypt_list.isEmpty()) { waypt_free(waypt_list.takeFirst()); } } #else void -waypt_flush(queue *head) +waypt_flush(queue* head) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(head, elem, tmp) { - waypoint *q = (waypoint *) dequeue(elem); + waypoint* q = (waypoint*) dequeue(elem); waypt_free(q); if (head == &waypt_head) { waypt_ct--; @@ -469,13 +470,13 @@ waypt_flush_all() } void -waypt_backup(signed int *count, queue **head_bak) +waypt_backup(signed int* count, queue** head_bak) { - queue *elem, *tmp, *qbackup; - waypoint *wpt; + queue* elem, *tmp, *qbackup; + waypoint* wpt; int no = 0; - qbackup = (queue *) xcalloc(1, sizeof(*qbackup)); + qbackup = (queue*) xcalloc(1, sizeof(*qbackup)); QUEUE_INIT(qbackup); #if NEWQ // Why does this code exist? @@ -488,7 +489,7 @@ waypt_backup(signed int *count, queue **head_bak) waypt_ct = 0; QUEUE_FOR_EACH(qbackup, elem, tmp) { - wpt = (waypoint *)elem; + wpt = (waypoint*)elem; waypt_add(waypt_dupe(wpt)); no++; } @@ -498,7 +499,7 @@ waypt_backup(signed int *count, queue **head_bak) } void -waypt_restore(signed int count, queue *head_bak) +waypt_restore(signed int count, queue* head_bak) { if (head_bak == NULL) { return; @@ -516,7 +517,7 @@ waypt_restore(signed int count, queue *head_bak) } void -waypt_add_url(waypoint *wpt, const QString& link, const QString& url_link_text) +waypt_add_url(waypoint* wpt, const QString& link, const QString& url_link_text) { wpt->url_link_list_.push_back(UrlLink(link, url_link_text)); } @@ -540,7 +541,7 @@ gcgeodist(const double lat1, const double lon1, */ double -waypt_time(const waypoint *wpt) +waypt_time(const waypoint* wpt) { if (!wpt->creation_time.isValid()) { return (double) 0; @@ -556,7 +557,7 @@ waypt_time(const waypoint *wpt) */ double -waypt_distance_ex(const waypoint *A, const waypoint *B) +waypt_distance_ex(const waypoint* A, const waypoint* B) { double res = 0; garmin_fs_p gmsd; @@ -566,11 +567,11 @@ waypt_distance_ex(const waypoint *A, const waypoint *B) } if ((gmsd = GMSD_FIND(A)) && (gmsd->ilinks != NULL)) { - garmin_ilink_t *link = gmsd->ilinks; + garmin_ilink_t* link = gmsd->ilinks; res = gcgeodist(A->latitude, A->longitude, link->lat, link->lon); while (link->next != NULL) { - garmin_ilink_t *prev = link; + garmin_ilink_t* prev = link; link = link->next; res += gcgeodist(prev->lat, prev->lon, link->lat, link->lon); } @@ -583,7 +584,7 @@ waypt_distance_ex(const waypoint *A, const waypoint *B) } double -waypt_distance(const waypoint *A, const waypoint *B) +waypt_distance(const waypoint* A, const waypoint* B) { if ((A == NULL) || (B == NULL)) { return 0; @@ -599,7 +600,7 @@ waypt_distance(const waypoint *A, const waypoint *B) */ double -waypt_speed_ex(const waypoint *A, const waypoint *B) +waypt_speed_ex(const waypoint* A, const waypoint* B) { double dist, time; @@ -622,7 +623,7 @@ waypt_speed_ex(const waypoint *A, const waypoint *B) */ double -waypt_speed(const waypoint *A, const waypoint *B) +waypt_speed(const waypoint* A, const waypoint* B) { double dist, time; @@ -643,7 +644,7 @@ waypt_speed(const waypoint *A, const waypoint *B) * Calculates "Course True" from A to B */ double -waypt_course(const waypoint *A, const waypoint *B) +waypt_course(const waypoint* A, const waypoint* B) { if (A && B) { return heading_true_degrees(RAD(A->latitude), RAD(A->longitude), RAD(B->latitude), RAD(B->longitude)); @@ -652,10 +653,10 @@ waypt_course(const waypoint *A, const waypoint *B) } } -geocache_data * -waypt_alloc_gc_data(waypoint *wpt) +geocache_data* +waypt_alloc_gc_data(waypoint* wpt) { - geocache_data *res = (geocache_data *)wpt->gc_data; + geocache_data* res = (geocache_data*)wpt->gc_data; if (res == &empty_gc_data) { res = wpt->gc_data = new geocache_data; } @@ -663,7 +664,7 @@ waypt_alloc_gc_data(waypoint *wpt) } int -waypt_empty_gc_data(const waypoint *wpt) +waypt_empty_gc_data(const waypoint* wpt) { return (wpt->gc_data == &empty_gc_data); } diff --git a/gpsbabel/wbt-200.cc b/gpsbabel/wbt-200.cc index 896c88c64..15cfd4876 100644 --- a/gpsbabel/wbt-200.cc +++ b/gpsbabel/wbt-200.cc @@ -87,10 +87,10 @@ static struct { * http://hexten.net/wiki/index.php/WBT-200_Comms_Protocol */ -static void *fd; -static FILE *fl; -static char *port; -static char *erase; +static void* fd; +static FILE* fl; +static char* port; +static char* erase; typedef enum { UNKNOWN, WBT200, WBT201, WSG1000 @@ -99,7 +99,7 @@ typedef enum { static wintec_gps_types dev_type = UNKNOWN; struct buf_chunk { - struct buf_chunk *next; + struct buf_chunk* next; size_t size; size_t used; /* data follows in memory */ @@ -112,25 +112,25 @@ struct buf_chunk { ((void *) ((char *) buf_CHUNK_DATA(c) + (offset))) struct buf_head { - struct buf_chunk *head; - struct buf_chunk *tail; + struct buf_chunk* head; + struct buf_chunk* tail; size_t alloc; size_t used; /* read position */ - struct buf_chunk *current; + struct buf_chunk* current; unsigned long offset; /* shoehorned in here primarily out of laziness */ unsigned checksum; }; struct read_state { - route_head *route_head_; + route_head* route_head_; unsigned wpn, tpn; struct buf_head data; }; -static void db(int l, const char *msg, ...) +static void db(int l, const char* msg, ...) { va_list ap; va_start(ap, msg); @@ -144,7 +144,7 @@ static void db(int l, const char *msg, ...) * tidy up its interface. */ -static void buf_init(struct buf_head *h, size_t alloc) +static void buf_init(struct buf_head* h, size_t alloc) { h->head = NULL; h->tail = NULL; @@ -154,9 +154,9 @@ static void buf_init(struct buf_head *h, size_t alloc) h->offset = 0; } -static void buf_empty(struct buf_head *h) +static void buf_empty(struct buf_head* h) { - struct buf_chunk *chunk, *next; + struct buf_chunk* chunk, *next; for (chunk = h->head; chunk; chunk = next) { next = chunk->next; xfree(chunk); @@ -167,15 +167,15 @@ static void buf_empty(struct buf_head *h) h->checksum = 0; } -static void buf_rewind(struct buf_head *h) +static void buf_rewind(struct buf_head* h) { h->current = h->head; h->offset = 0; } -static size_t buf_read(struct buf_head *h, void *data, size_t len) +static size_t buf_read(struct buf_head* h, void* data, size_t len) { - char *bp = (char *) data; + char* bp = (char*) data; size_t got = 0; while (len != 0 && h->current != NULL) { @@ -203,9 +203,9 @@ static size_t buf_read(struct buf_head *h, void *data, size_t len) return got; } -static void buf_extend(struct buf_head *h, size_t amt) +static void buf_extend(struct buf_head* h, size_t amt) { - struct buf_chunk *c; + struct buf_chunk* c; size_t sz = amt + sizeof(struct buf_chunk); c = (struct buf_chunk*) xmalloc(sz); @@ -222,9 +222,9 @@ static void buf_extend(struct buf_head *h, size_t amt) h->tail = c; } -static void buf_update_checksum(struct buf_head *h, const void *data, size_t len) +static void buf_update_checksum(struct buf_head* h, const void* data, size_t len) { - unsigned char *cp = (unsigned char *) data; + unsigned char* cp = (unsigned char*) data; unsigned i; db(4, "Updating checksum with %p, %lu, before: %02x ", @@ -235,10 +235,10 @@ static void buf_update_checksum(struct buf_head *h, const void *data, size_t len db(4, "after: %02x\n", h->checksum); } -static void buf_write(struct buf_head *h, const void *data, size_t len) +static void buf_write(struct buf_head* h, const void* data, size_t len) { size_t avail; - const char *bp = (const char *) data; + const char* bp = (const char*) data; buf_update_checksum(h, data, len); @@ -254,7 +254,7 @@ static void buf_write(struct buf_head *h, const void *data, size_t len) avail = len; } - memcpy((char *) buf_CHUNK_PTR(h->tail, h->tail->used), bp, avail); + memcpy((char*) buf_CHUNK_PTR(h->tail, h->tail->used), bp, avail); h->tail->used += avail; bp += avail; len -= avail; @@ -272,7 +272,7 @@ static void rd_drain() } } -static void rd_line(char *buf, int len) +static void rd_line(char* buf, int len) { int rc; if (rc = gbser_read_line(fd, buf, len, TIMEOUT, 0x0A, 0x0D), rc != gbser_OK) { @@ -281,7 +281,7 @@ static void rd_line(char *buf, int len) db(3, "Got response: \"%s\"\n", buf); } -static void wr_cmd(const char *cmd) +static void wr_cmd(const char* cmd) { int rc; db(3, "Sending: %s\n", cmd); @@ -290,13 +290,13 @@ static void wr_cmd(const char *cmd) } } -static void wr_cmdl(const char *cmd) +static void wr_cmdl(const char* cmd) { wr_cmd(cmd); wr_cmd(NL); } -static int expect(const char *str) +static int expect(const char* str) { int state = 0; int c, i; @@ -391,7 +391,7 @@ static wintec_gps_types guess_device() } -static void rd_init(const char *fname) +static void rd_init(const char* fname) { port = xstrdup(fname); @@ -414,7 +414,7 @@ static void rd_deinit(void) xfree(port); } -static int rd_buf(void *buf, int len) +static int rd_buf(void* buf, int len) { int rc; if (rc = gbser_read_wait(fd, buf, len, TIMEOUT), rc < 0) { @@ -426,7 +426,7 @@ static int rd_buf(void *buf, int len) return 1; } -static void file_init(const char *fname) +static void file_init(const char* fname) { db(1, "Opening file...\n"); if ((fl = fopen(fname, "rb")) == NULL) { @@ -440,7 +440,7 @@ static void file_deinit(void) fclose(fl); } -static int starts_with(const char *buf, const char *pat) +static int starts_with(const char* buf, const char* pat) { size_t pat_len = strlen(pat); return (pat_len <= strlen(buf)) @@ -451,7 +451,7 @@ static int starts_with(const char *buf, const char *pat) /* Send a command then wait for a line starting with the command string * to be returned. */ -static int do_cmd(const char *cmd, const char *expect, char *buf, int len) +static int do_cmd(const char* cmd, const char* expect, char* buf, int len) { int trycount; @@ -481,24 +481,24 @@ static int do_cmd(const char *cmd, const char *expect, char *buf, int len) /* Issue a command that expects the same string to be echoed * back as an ACK */ -static int do_simple(const char *cmd, char *buf, int len) +static int do_simple(const char* cmd, char* buf, int len) { return do_cmd(cmd, cmd, buf, len); } -static char *get_param(const char *cmd, char *buf, int len) +static char* get_param(const char* cmd, char* buf, int len) { int cl = do_simple(cmd, buf, len); return buf + cl + 1; } -static int get_param_int(const char *cmd) +static int get_param_int(const char* cmd) { char buf[80]; return atoi(get_param(cmd, buf, sizeof(buf))); } -static double get_param_float(const char *cmd) +static double get_param_float(const char* cmd) { char buf[80]; return atof(get_param(cmd, buf, sizeof(buf))); @@ -540,10 +540,10 @@ static int check_date(uint32_t tim) mday > 0 && mday <= 31 && mon > 0 && mon <= 12 && year >= 4; } -static waypoint *make_point(double lat, double lon, double alt, time_t tim, const char *fmt, int index) +static waypoint* make_point(double lat, double lon, double alt, time_t tim, const char* fmt, int index) { char wp_name[20]; - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); sprintf(wp_name, fmt, index); @@ -556,23 +556,23 @@ static waypoint *make_point(double lat, double lon, double alt, time_t tim, cons return wpt; } -static waypoint *make_waypoint(struct read_state *st, double lat, double lon, double alt, time_t tim) +static waypoint* make_waypoint(struct read_state* st, double lat, double lon, double alt, time_t tim) { return make_point(lat, lon, alt, tim, "WP%04d", ++st->wpn); } -static waypoint *make_trackpoint(struct read_state *st, double lat, double lon, double alt, time_t tim) +static waypoint* make_trackpoint(struct read_state* st, double lat, double lon, double alt, time_t tim) { return make_point(lat, lon, alt, tim, "TP%04d", ++st->tpn); } -static int wbt200_data_chunk(struct read_state *st, const void *buf, int fmt) +static int wbt200_data_chunk(struct read_state* st, const void* buf, int fmt) { uint32_t tim; double lat, lon, alt; time_t rtim; - waypoint *tpt = NULL; - const char *bp = (const char*) buf; + waypoint* tpt = NULL; + const char* bp = (const char*) buf; size_t buf_used = fmt_version[fmt].reclen; tim = le_read32(bp + 0); @@ -614,7 +614,7 @@ static int wbt200_data_chunk(struct read_state *st, const void *buf, int fmt) } /* Return true iff the data appears valid with the specified record length */ -static int is_valid(struct buf_head *h, int fmt) +static int is_valid(struct buf_head* h, int fmt) { char buf[RECLEN_MAX]; size_t reclen = fmt_version[fmt].reclen; @@ -651,7 +651,7 @@ static int is_valid(struct buf_head *h, int fmt) return 1; } -static void wbt200_process_data(struct read_state *pst, int fmt) +static void wbt200_process_data(struct read_state* pst, int fmt) { char buf[RECLEN_MAX]; size_t reclen = fmt_version[fmt].reclen; @@ -669,7 +669,7 @@ static void wbt200_process_data(struct read_state *pst, int fmt) } } -static void state_init(struct read_state *pst) +static void state_init(struct read_state* pst) { pst->route_head_ = NULL; pst->wpn = 0; @@ -678,13 +678,13 @@ static void state_init(struct read_state *pst) buf_init(&pst->data, RECLEN_V1 * RECLEN_V2); } -static void state_empty(struct read_state *pst) +static void state_empty(struct read_state* pst) { buf_empty(&pst->data); state_init(pst); } -static int want_bytes(struct buf_head *h, size_t len) +static int want_bytes(struct buf_head* h, size_t len) { char buf[512]; @@ -788,9 +788,9 @@ static void wbt200_data_read(void) state_empty(&st); } -static int all_null(const void *buf, const int len) +static int all_null(const void* buf, const int len) { - const char *bp = (const char *) buf; + const char* bp = (const char*) buf; int i; for (i = 0; i < len; i++) { @@ -802,14 +802,14 @@ static int all_null(const void *buf, const int len) return 1; } -static int wbt201_data_chunk(struct read_state *st, const void *buf) +static int wbt201_data_chunk(struct read_state* st, const void* buf) { uint32_t tim; uint16_t flags; double lat, lon, alt; time_t rtim; - waypoint *tpt = NULL; - const char *bp = (const char *) buf; + waypoint* tpt = NULL; + const char* bp = (const char*) buf; /* Zero records are skipped */ if (all_null(buf, RECLEN_WBT201)) { @@ -831,7 +831,7 @@ static int wbt201_data_chunk(struct read_state *st, const void *buf) rtim = decode_date(tim); if ((flags & WBT201_WAYPOINT) && (global_opts.masked_objective & WPTDATAMASK)) { - waypoint *wpt = make_waypoint(st, lat, lon, alt, rtim); + waypoint* wpt = make_waypoint(st, lat, lon, alt, rtim); waypt_add(wpt); } @@ -854,7 +854,7 @@ static int wbt201_data_chunk(struct read_state *st, const void *buf) return 1; } -static void wbt201_process_chunk(struct read_state *st) +static void wbt201_process_chunk(struct read_state* st) { char buf[RECLEN_WBT201]; @@ -866,13 +866,13 @@ static void wbt201_process_chunk(struct read_state *st) } } -static int wbt201_read_chunk(struct read_state *st, unsigned pos, unsigned limit) +static int wbt201_read_chunk(struct read_state* st, unsigned pos, unsigned limit) { char cmd_buf[30]; char line_buf[100]; unsigned long cs; - char *lp, *op; - static const char *cs_prefix = "@AL,CS,"; + char* lp, *op; + static const char* cs_prefix = "@AL,CS,"; unsigned want = limit - pos; if (want > WBT201CHUNK) { @@ -931,7 +931,7 @@ static void wbt201_data_read(void) struct read_state st; unsigned tries; - const char *tmp; + const char* tmp; double ver_hw; double ver_sw; @@ -1017,7 +1017,7 @@ static void file_read(void) struct read_state st; int fmt; - const char * tk1_magic = TK1_MAGIC; + const char* tk1_magic = TK1_MAGIC; size_t tk1_magic_len = strlen(tk1_magic) + 1; state_init(&st); diff --git a/gpsbabel/wfff_xml.cc b/gpsbabel/wfff_xml.cc index 333dbdb52..65be3a8f5 100644 --- a/gpsbabel/wfff_xml.cc +++ b/gpsbabel/wfff_xml.cc @@ -23,11 +23,11 @@ #include "xmlgeneric.h" /* argument storage */ -static char * aicicon =0; -static char * aioicon =0; -static char * ahcicon =0; -static char * ahoicon =0; -static char * snmac =0; +static char* aicicon =0; +static char* aioicon =0; +static char* ahcicon =0; +static char* ahoicon =0; +static char* snmac =0; static arglist_t wfff_xml_args[] = { @@ -97,7 +97,7 @@ static double ap_lat =0.0; static double ap_lon =0.0; /* Start of AP block */ -void wfff_s(const char *args, const QXmlStreamAttributes* unused) +void wfff_s(const char* args, const QXmlStreamAttributes* unused) { xfreez(ap_mac); xfreez(ap_ssid); @@ -114,84 +114,84 @@ void wfff_s(const char *args, const QXmlStreamAttributes* unused) ap_lon=0.0; } -void wfff_mac(const char *args, const QXmlStreamAttributes* unused) +void wfff_mac(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_mac = xstrdup(args); } } -void wfff_ssid(const char *args, const QXmlStreamAttributes* unused) +void wfff_ssid(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_ssid = xstrdup(args); } } -void wfff_type(const char *args, const QXmlStreamAttributes* unused) +void wfff_type(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_type = xstrdup(args); } } -void wfff_mnrssi(const char *args, const QXmlStreamAttributes* unused) +void wfff_mnrssi(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_mnrssi = atof(args); } } -void wfff_mxrssi(const char *args, const QXmlStreamAttributes* unused) +void wfff_mxrssi(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_mxrssi = atof(args); } } -void wfff_chan(const char *args, const QXmlStreamAttributes* unused) +void wfff_chan(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_chan = atoi(args); } } -void wfff_first(const char *args, const QXmlStreamAttributes* unused) +void wfff_first(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_first = xml_parse_time(args).toTime_t(); } } -void wfff_last(const char *args, const QXmlStreamAttributes* unused) +void wfff_last(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_last = xstrdup(args); } } -void wfff_wep(const char *args, const QXmlStreamAttributes* unused) +void wfff_wep(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_wep = xstrdup(args); } } -void wfff_hdop(const char *args, const QXmlStreamAttributes* unused) +void wfff_hdop(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_hdop = atof(args); } } -void wfff_lat(const char *args, const QXmlStreamAttributes* unused) +void wfff_lat(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_lat = atof(args); } } -void wfff_lon(const char *args, const QXmlStreamAttributes* unused) +void wfff_lon(const char* args, const QXmlStreamAttributes* unused) { if (args) { ap_lon = atof(args); @@ -201,7 +201,7 @@ void wfff_lon(const char *args, const QXmlStreamAttributes* unused) /* End of AP Block, set waypoint and add */ static long tosscount=0; -void wfff_e(const char *args, const QXmlStreamAttributes* unused) +void wfff_e(const char* args, const QXmlStreamAttributes* unused) { waypoint* wpt_tmp =0; char desc[255] ="\0"; @@ -260,7 +260,7 @@ void wfff_e(const char *args, const QXmlStreamAttributes* unused) void -wfff_xml_rd_init(const char *fname) +wfff_xml_rd_init(const char* fname) { tosscount = 0; diff --git a/gpsbabel/wintec_tes.cc b/gpsbabel/wintec_tes.cc index 99715b76e..71cb009cb 100644 --- a/gpsbabel/wintec_tes.cc +++ b/gpsbabel/wintec_tes.cc @@ -27,7 +27,7 @@ static gbfile* fin; static void -wintec_tes_rd_init(const char *fname) +wintec_tes_rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); } @@ -56,11 +56,11 @@ wintec_date_to_time(uint32_t w) static void wintec_tes_read(void) { - route_head *trk = route_head_alloc(); + route_head* trk = route_head_alloc(); track_add_head(trk); while (!gbfeof(fin)) { - waypoint *wpt; + waypoint* wpt; uint16_t flags = gbfgetuint16(fin); uint32_t date = gbfgetuint32(fin); int32_t latitude = gbfgetint32(fin); @@ -85,7 +85,7 @@ wintec_tes_read(void) // Wintec's software puts a waypoint in the track, so we // mock that. if (flags & 0x02) { - waypoint *temp = waypt_dupe(wpt); + waypoint* temp = waypt_dupe(wpt); waypt_add(temp); } diff --git a/gpsbabel/xcsv.cc b/gpsbabel/xcsv.cc index 56ccfc364..456836ccf 100644 --- a/gpsbabel/xcsv.cc +++ b/gpsbabel/xcsv.cc @@ -32,16 +32,16 @@ #define MYNAME "XCSV" #define ISSTOKEN(a,b) (strncmp(a,b, strlen(b)) == 0) -static char *styleopt = NULL; -static char *snlenopt = NULL; -static char *snwhiteopt = NULL; -static char *snupperopt = NULL; -static char *snuniqueopt = NULL; -char *prefer_shortnames = NULL; -char *xcsv_urlbase = NULL; -static char *opt_datum; +static char* styleopt = NULL; +static char* snlenopt = NULL; +static char* snwhiteopt = NULL; +static char* snupperopt = NULL; +static char* snuniqueopt = NULL; +char* prefer_shortnames = NULL; +char* xcsv_urlbase = NULL; +static char* opt_datum; -static const char *intstylebuf = NULL; +static const char* intstylebuf = NULL; static arglist_t xcsv_args[] = { @@ -104,9 +104,9 @@ char_map_t xcsv_char_table[] = { void xcsv_destroy_style(void) { - queue *elem, *tmp; - field_map_t *fmp; - ogue_t *ogp; + queue* elem, *tmp; + field_map_t* fmp; + ogue_t* ogp; int internal = 0; /* @@ -116,7 +116,7 @@ xcsv_destroy_style(void) /* destroy the prologue */ QUEUE_FOR_EACH(&xcsv_file.prologue, elem, tmp) { - ogp = (ogue_t *)elem; + ogp = (ogue_t*)elem; if (ogp->val) { xfree(ogp->val); } @@ -127,7 +127,7 @@ xcsv_destroy_style(void) /* destroy the epilogue */ QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) { - ogp = (ogue_t *)elem; + ogp = (ogue_t*)elem; if (ogp->val) { xfree(ogp->val); } @@ -138,7 +138,7 @@ xcsv_destroy_style(void) /* destroy the ifields */ QUEUE_FOR_EACH(&xcsv_file.ifield, elem, tmp) { - fmp = (field_map_t *) elem; + fmp = (field_map_t*) elem; if (fmp->key) { xfree(fmp->key); } @@ -156,7 +156,7 @@ xcsv_destroy_style(void) /* destroy the ofields, if they are not re-mapped to ifields. */ if (xcsv_file.ofield != &xcsv_file.ifield) { QUEUE_FOR_EACH(xcsv_file.ofield, elem, tmp) { - fmp = (field_map_t *) elem; + fmp = (field_map_t*) elem; if (fmp->key) { xfree(fmp->key); } @@ -211,10 +211,10 @@ xcsv_destroy_style(void) xcsv_file.is_internal = internal; } -const char * -xcsv_get_char_from_constant_table(char *key) +const char* +xcsv_get_char_from_constant_table(char* key) { - char_map_t *cm = xcsv_char_table; + char_map_t* cm = xcsv_char_table; while ((cm->key) && (strcmp(key, cm->key) != 0)) { cm++; @@ -224,13 +224,13 @@ xcsv_get_char_from_constant_table(char *key) } static void -xcsv_parse_style_line(char *sbuff) +xcsv_parse_style_line(char* sbuff) { int i, linecount = 0; - char *s, *sp; - char *p; - const char *cp; - char *key, *val, *pfc; + char* s, *sp; + char* p; + const char* cp; + char* key, *val, *pfc; /* * tokens should be parsed longest to shortest, unless something @@ -263,7 +263,7 @@ xcsv_parse_style_line(char *sbuff) /* field delimiters are always bad characters */ if (0 == strcmp(p, "\\w")) { - char *s = xstrappend(xcsv_file.badchars, " \n\r"); + char* s = xstrappend(xcsv_file.badchars, " \n\r"); if (xcsv_file.badchars) { xfree(xcsv_file.badchars); } @@ -290,180 +290,142 @@ xcsv_parse_style_line(char *sbuff) /* field_enclosers are always bad characters */ if (xcsv_file.badchars) { - xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, - strlen(xcsv_file.badchars) + - strlen(p) + 1); + xcsv_file.badchars = (char*) xrealloc(xcsv_file.badchars, + strlen(xcsv_file.badchars) + + strlen(p) + 1); } else { - xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); + xcsv_file.badchars = (char*) xcalloc(strlen(p) + 1, 1); } strcat(xcsv_file.badchars, p); xfree(p); - } else + } else - if (ISSTOKEN(sbuff, "RECORD_DELIMITER")) { - sp = csv_stringtrim(&sbuff[17], "\"", 1); - cp = xcsv_get_char_from_constant_table(sp); - if (cp) { - xcsv_file.record_delimiter = xstrdup(cp); - xfree(sp); - } else { - xcsv_file.record_delimiter = sp; - } + if (ISSTOKEN(sbuff, "RECORD_DELIMITER")) { + sp = csv_stringtrim(&sbuff[17], "\"", 1); + cp = xcsv_get_char_from_constant_table(sp); + if (cp) { + xcsv_file.record_delimiter = xstrdup(cp); + xfree(sp); + } else { + xcsv_file.record_delimiter = sp; + } - p = csv_stringtrim(xcsv_file.record_delimiter, " ", 0); + p = csv_stringtrim(xcsv_file.record_delimiter, " ", 0); - /* record delimiters are always bad characters */ - if (xcsv_file.badchars) { - xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, - strlen(xcsv_file.badchars) + - strlen(p) + 1); - } else { - xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); - } + /* record delimiters are always bad characters */ + if (xcsv_file.badchars) { + xcsv_file.badchars = (char*) xrealloc(xcsv_file.badchars, + strlen(xcsv_file.badchars) + + strlen(p) + 1); + } else { + xcsv_file.badchars = (char*) xcalloc(strlen(p) + 1, 1); + } - strcat(xcsv_file.badchars, p); + strcat(xcsv_file.badchars, p); - xfree(p); + xfree(p); - } else - - if (ISSTOKEN(sbuff, "FORMAT_TYPE")) { - const char *p; - for (p = &sbuff[11]; *p && isspace(*p); p++) { - ; - } - if (ISSTOKEN(p, "INTERNAL")) { - xcsv_file.type = ff_type_internal; - } - /* this is almost inconcievable... */ - if (ISSTOKEN(p, "SERIAL")) { - xcsv_file.type = ff_type_serial; - } } else - if (ISSTOKEN(sbuff, "DESCRIPTION")) { - xcsv_file.description = csv_stringtrim(&sbuff[11],"", 0); + if (ISSTOKEN(sbuff, "FORMAT_TYPE")) { + const char* p; + for (p = &sbuff[11]; *p && isspace(*p); p++) { + ; + } + if (ISSTOKEN(p, "INTERNAL")) { + xcsv_file.type = ff_type_internal; + } + /* this is almost inconcievable... */ + if (ISSTOKEN(p, "SERIAL")) { + xcsv_file.type = ff_type_serial; + } } else - if (ISSTOKEN(sbuff, "EXTENSION")) { - xcsv_file.extension = csv_stringtrim(&sbuff[10],"", 0); + if (ISSTOKEN(sbuff, "DESCRIPTION")) { + xcsv_file.description = csv_stringtrim(&sbuff[11],"", 0); } else - if (ISSTOKEN(sbuff, "SHORTLEN")) { - if (xcsv_file.mkshort_handle) { - setshort_length(xcsv_file.mkshort_handle, atoi(&sbuff[9])); - } + if (ISSTOKEN(sbuff, "EXTENSION")) { + xcsv_file.extension = csv_stringtrim(&sbuff[10],"", 0); } else - if (ISSTOKEN(sbuff, "SHORTWHITE")) { + if (ISSTOKEN(sbuff, "SHORTLEN")) { if (xcsv_file.mkshort_handle) { - setshort_whitespace_ok(xcsv_file.mkshort_handle, atoi(&sbuff[12])); + setshort_length(xcsv_file.mkshort_handle, atoi(&sbuff[9])); } } else - if (ISSTOKEN(sbuff, "BADCHARS")) { - sp = csv_stringtrim(&sbuff[9], "\"", 1); - cp = xcsv_get_char_from_constant_table(sp); - - if (cp) { - p = xstrdup(cp); - xfree(sp); - } else { - p = sp; + if (ISSTOKEN(sbuff, "SHORTWHITE")) { + if (xcsv_file.mkshort_handle) { + setshort_whitespace_ok(xcsv_file.mkshort_handle, atoi(&sbuff[12])); } + } else - if (xcsv_file.badchars) { - xcsv_file.badchars = (char *) xrealloc(xcsv_file.badchars, - strlen(xcsv_file.badchars) + - strlen(p) + 1); - } else { - xcsv_file.badchars = (char *) xcalloc(strlen(p) + 1, 1); - } + if (ISSTOKEN(sbuff, "BADCHARS")) { + sp = csv_stringtrim(&sbuff[9], "\"", 1); + cp = xcsv_get_char_from_constant_table(sp); - strcat(xcsv_file.badchars, p); + if (cp) { + p = xstrdup(cp); + xfree(sp); + } else { + p = sp; + } - xfree(p); + if (xcsv_file.badchars) { + xcsv_file.badchars = (char*) xrealloc(xcsv_file.badchars, + strlen(xcsv_file.badchars) + + strlen(p) + 1); + } else { + xcsv_file.badchars = (char*) xcalloc(strlen(p) + 1, 1); + } - } else + strcat(xcsv_file.badchars, p); + + xfree(p); - if (ISSTOKEN(sbuff, "PROLOGUE")) { - xcsv_prologue_add(xstrdup(&sbuff[9])); } else - if (ISSTOKEN(sbuff, "EPILOGUE")) { - xcsv_epilogue_add(xstrdup(&sbuff[9])); + if (ISSTOKEN(sbuff, "PROLOGUE")) { + xcsv_prologue_add(xstrdup(&sbuff[9])); } else - if (ISSTOKEN(sbuff, "ENCODING")) { - p = csv_stringtrim(&sbuff[8], "\"", 1); - cet_convert_init(p, 1); - xfree(p); + if (ISSTOKEN(sbuff, "EPILOGUE")) { + xcsv_epilogue_add(xstrdup(&sbuff[9])); } else - if (ISSTOKEN(sbuff, "DATUM")) { - p = csv_stringtrim(&sbuff[5], "\"", 1); - xcsv_file.gps_datum = GPS_Lookup_Datum_Index(p); - is_fatal(xcsv_file.gps_datum < 0, MYNAME ": datum \"%s\" is not supported.", p); + if (ISSTOKEN(sbuff, "ENCODING")) { + p = csv_stringtrim(&sbuff[8], "\"", 1); + cet_convert_init(p, 1); xfree(p); } else - if (ISSTOKEN(sbuff, "DATATYPE")) { - p = csv_stringtrim(&sbuff[8], "\"", 1); - if (case_ignore_strcmp(p, "TRACK") == 0) { - xcsv_file.datatype = trkdata; - } else if (case_ignore_strcmp(p, "ROUTE") == 0) { - xcsv_file.datatype = rtedata; - } else if (case_ignore_strcmp(p, "WAYPOINT") == 0) { - xcsv_file.datatype = wptdata; - } else { - fatal(MYNAME ": Unknown data type \"%s\"!\n", p); - } + if (ISSTOKEN(sbuff, "DATUM")) { + p = csv_stringtrim(&sbuff[5], "\"", 1); + xcsv_file.gps_datum = GPS_Lookup_Datum_Index(p); + is_fatal(xcsv_file.gps_datum < 0, MYNAME ": datum \"%s\" is not supported.", p); xfree(p); - } else - if (ISSTOKEN(sbuff, "IFIELD")) { - key = val = pfc = NULL; - - s = csv_lineparse(&sbuff[6], ",", "", linecount); - - i = 0; - while (s) { - switch (i) { - case 0: - /* key */ - key = csv_stringtrim(s, "\"", 1); - break; - case 1: - /* default value */ - val = csv_stringtrim(s, "\"", 1); - break; - case 2: - /* printf conversion */ - pfc = csv_stringtrim(s, "\"", 1); - break; - default: - break; - } - i++; - - s = csv_lineparse(NULL, ",", "", linecount); + if (ISSTOKEN(sbuff, "DATATYPE")) { + p = csv_stringtrim(&sbuff[8], "\"", 1); + if (case_ignore_strcmp(p, "TRACK") == 0) { + xcsv_file.datatype = trkdata; + } else if (case_ignore_strcmp(p, "ROUTE") == 0) { + xcsv_file.datatype = rtedata; + } else if (case_ignore_strcmp(p, "WAYPOINT") == 0) { + xcsv_file.datatype = wptdata; + } else { + fatal(MYNAME ": Unknown data type \"%s\"!\n", p); } - - xcsv_ifield_add(key, val, pfc); + xfree(p); } else - /* - * as OFIELDs are implemented as an after-thought, I'll - * leave this as it's own parsing for now. We could - * change the world on ifield vs ofield format later.. - */ - if (ISSTOKEN(sbuff, "OFIELD")) { - int options = 0; + if (ISSTOKEN(sbuff, "IFIELD")) { key = val = pfc = NULL; s = csv_lineparse(&sbuff[6], ",", "", linecount); @@ -483,26 +445,64 @@ xcsv_parse_style_line(char *sbuff) /* printf conversion */ pfc = csv_stringtrim(s, "\"", 1); break; - case 3: - /* Any additional options. */ - if (strstr(s, "no_delim_before")) { - options |= OPTIONS_NODELIM; - } - if (strstr(s, "absolute")) { - options |= OPTIONS_ABSOLUTE; - } - if (strstr(s, "optional")) { - options |= OPTIONS_OPTIONAL; - } default: break; } i++; + s = csv_lineparse(NULL, ",", "", linecount); } - xcsv_ofield_add(key, val, pfc, options); - } + xcsv_ifield_add(key, val, pfc); + + } else + + /* + * as OFIELDs are implemented as an after-thought, I'll + * leave this as it's own parsing for now. We could + * change the world on ifield vs ofield format later.. + */ + if (ISSTOKEN(sbuff, "OFIELD")) { + int options = 0; + key = val = pfc = NULL; + + s = csv_lineparse(&sbuff[6], ",", "", linecount); + + i = 0; + while (s) { + switch (i) { + case 0: + /* key */ + key = csv_stringtrim(s, "\"", 1); + break; + case 1: + /* default value */ + val = csv_stringtrim(s, "\"", 1); + break; + case 2: + /* printf conversion */ + pfc = csv_stringtrim(s, "\"", 1); + break; + case 3: + /* Any additional options. */ + if (strstr(s, "no_delim_before")) { + options |= OPTIONS_NODELIM; + } + if (strstr(s, "absolute")) { + options |= OPTIONS_ABSOLUTE; + } + if (strstr(s, "optional")) { + options |= OPTIONS_OPTIONAL; + } + default: + break; + } + i++; + s = csv_lineparse(NULL, ",", "", linecount); + } + + xcsv_ofield_add(key, val, pfc, options); + } } } @@ -513,10 +513,10 @@ xcsv_parse_style_line(char *sbuff) * that "ignore to end of line" comments work right. */ static void -xcsv_parse_style_buff(const char *sbuff) +xcsv_parse_style_buff(const char* sbuff) { char ibuf[256]; - char *ibufp; + char* ibufp; size_t i; while (*sbuff) { @@ -534,10 +534,10 @@ xcsv_parse_style_buff(const char *sbuff) } static void -xcsv_read_style(const char *fname) +xcsv_read_style(const char* fname) { - char *sbuff; - gbfile *fp; + char* sbuff; + gbfile* fp; xcsv_file_init(); @@ -565,7 +565,7 @@ xcsv_read_style(const char *fname) * the xcsv parser and make it ready for general use. */ void -xcsv_read_internal_style(const char *style_buf) +xcsv_read_internal_style(const char* style_buf) { xcsv_file_init(); xcsv_file.is_internal = 1; @@ -583,7 +583,7 @@ xcsv_read_internal_style(const char *style_buf) } void -xcsv_setup_internal_style(const char *style_buf) +xcsv_setup_internal_style(const char* style_buf) { xcsv_file_init(); xcsv_destroy_style(); @@ -593,7 +593,7 @@ xcsv_setup_internal_style(const char *style_buf) static void -xcsv_rd_init(const char *fname) +xcsv_rd_init(const char* fname) { /* @@ -630,7 +630,7 @@ xcsv_rd_deinit(void) } static void -xcsv_wr_init(const char *fname) +xcsv_wr_init(const char* fname) { /* if we don't have an internal style defined, we need to * read it from a user-supplied style file, or die trying. @@ -649,7 +649,7 @@ xcsv_wr_init(const char *fname) } xcsv_file.xcsvfp = gbfopen(fname, "w", MYNAME); - xcsv_file.fname = (char *)fname; + xcsv_file.fname = (char*)fname; /* set mkshort options from the command line */ if (global_opts.synthesize_shortnames) { @@ -678,7 +678,7 @@ xcsv_wr_init(const char *fname) } static void -xcsv_wr_position_init(const char *fname) +xcsv_wr_position_init(const char* fname) { xcsv_wr_init(fname); } @@ -699,7 +699,7 @@ xcsv_wr_position_deinit(void) static void -xcsv_wr_position(waypoint *wpt) +xcsv_wr_position(waypoint* wpt) { /* Tweak incoming name if we don't have a fix */ switch (wpt->fix) { @@ -736,6 +736,6 @@ ff_vecs_t xcsv_vecs = { }; #else -void xcsv_read_internal_style(const char *style_buf) {} -void xcsv_setup_internal_style(const char *style_buf) {} +void xcsv_read_internal_style(const char* style_buf) {} +void xcsv_setup_internal_style(const char* style_buf) {} #endif //CSVFMTS_ENABLED diff --git a/gpsbabel/xhtmlent.cc b/gpsbabel/xhtmlent.cc index 9c6fd8c20..1088238e3 100644 --- a/gpsbabel/xhtmlent.cc +++ b/gpsbabel/xhtmlent.cc @@ -1,4 +1,4 @@ -const char *xhtml_entities = +const char* xhtml_entities = "